-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Close all folds without unwanted autofolding/unfolding triggered by insert mode exit. #85
Comments
Do you mean |
I made a demo of this issue. Should I open a new one? There are different discussions elsewhere on that. Autofolding-when-escaping-from-insert-mode-2023-02-04_14.37.52.mp4
Reproduce
Environment
...
local opt = vim.opt
opt.foldopen:append("insert")
opt.foldmethod="expr"
opt.foldlevel=1
opt.foldlevelstart=99 -- 0 to close all folds upon opening file
opt.foldminlines=4
opt.foldcolumn="auto"
opt.foldenable=true Related discussions elsewhere |
|
|
This happens to me as well. It has something to do with the Whenever I use If I use the |
Thank you! I just fixed it by remapping zM to |
Dear kevinhwang91 and nvim-ufo users,
In the issue list there are several issues about unwanted behavior of zR and zM commands: unwanted automatic folding/unfolding triggered by insert mode exit. See issues #7, #49, #57 and #62. I have the same problem and none of solutions at metioned issues works for me. So I made my own one. I made another implementation of zM command "closeAllFolds" on top of zC command witch is not causing unwanted behaviour.
New implementation of "closeAllFolds" command.
Press F9 key and the following script will walk the buffer top to bottom and invoke zC command at each line:
Result
All parts of code are folded. Exiting from insert mode not triggering any automatic folding/unfolding, everything stays the same as before insert mode entrance.
I hope it will be useful for people with the same issue.
System setup
Operating system: Linux Debian 11.
Neovim version: v0.7.2
nvim-ufo version(commit): ad4ecb6
LSP server: gopls
LSP client: nvim LSP (option 2 from minimal config)
nvim-ufo config:
The text was updated successfully, but these errors were encountered: