-
Notifications
You must be signed in to change notification settings - Fork 50
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
when using zr
zm
or :set foldlevel=n
folds autoclose to that level after edit
#62
Comments
It's limilition of |
Oh ok, thanks for the info, I see now that it is in the README.md under Usage (my bad.. sry) If you ever decide to tackle this, I would definitely appreciate it. I do think this is already such a cool plugin, the syntax highlighting in the folds are an absolute game-changer for usability, the main reason I didn't like folds before, and should be part of core (neo)vim imho. |
It's the duplicate of #49. I read this issue from my cell phone roughly just now. |
The core is hard to imp syntax fold, I have read the source code so I release this plugin. ufo is the best solution for neovim fold AFAIK, never block, extremely fast. |
yes,
These issues makes I don't fully understand how folds and ufo work, but maybe the solution could be that |
Yes, From example 2 you provided, I think you need to change the |
I tried to make a video of the main usecase I use this for, it is not a super important usecase, but I do encounter it regularly in my work, and I seem to default to this behavior. I added some pseudo C++ code where there are 2 nested namespaces then it has a few classes with a bunch of functions, these functions live at the same foldlevel, but are in different parent folds. This is the condition where this usecase is most effective imo, things at the same foldlevel but in different parent folds. Without moving the cursor I can close all the folds use_case_zr_zm.mp4Doing this without I've been experimenting a bit, and it seems that it is possible to make a visual selection and then do open fold |
example: vim.keymap.set('n', 'zm', require('ufo').closeFoldsWith, {})
vim.keymap.set('n', 'zm', require('ufo').closeFoldsWith, {}) eg.
|
Neovim version (nvim -v | head -n1)
NVIM v0.7.2
Operating system/version
Manjaro Linux (updated yesterday)
How to reproduce the issue
cat mini.lua
nvim --clean -u mini.lua
:set foldlevel = 2
zo
Expected behavior
The folds stays open
Actual behavior
The fold autocloses
It seems to be related to the fix/workaround of #7 where it seems the folds that are open are only 'remembered' when the window foldlevel is larger than the open folds?
Not sure, maybe this is just the way ufo works, and can't be easily fixed?
Additionally, not changing the foldlevel when doing
zM
(openAllFolds) orzR
(closeAllFolds) also breaks thezr
andzm
behavior as they seem to work by setting the foldlevel:I tend to use folds as follows (in C++ code with lots foldlevels due to namespaces and classes)
zR
, which with default neovim sets the foldlevel to 0, but this doesn't happen withcloseAllFolds
zm
to see the function signatures I'm interested in. The default behavior is then thatzm
increased the foldlevel by 1. But because the foldlevel is still 99, it results in changing the foldlevel to the highest foldlevel in the buffer/window. So as a workaround I now set the foldlevel manually with:set foldlevel=x
to what I need.zO
. But this doesn't work now, because when the foldlevel is set to the foldlevel of the function, the fold will autoclose as soon as I go from insert mode to normal mode.The text was updated successfully, but these errors were encountered: