-
Notifications
You must be signed in to change notification settings - Fork 1
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
Add option to enhance recursive zC
to all nested folds
#5
Comments
It closes all folds under the cursor recursively. Folds that are contained in the fold of the cursor line are also changed. Related Issues: #5
Open all folds under the cursor recursively. Folds that are contained in the fold of the cursor line are also changed. Related Issues: #5
Toggle the fold status of the fold under the cursor and all folds contained in this fold. Related Issues: #5
I've added some <Plug> mappings, that I think do what your asking for. Here's what you can put in your vimrc to try them out.
Let me know how these work out for you. I'm the least confident in the behavior of the zA mapping out of the 3. |
Thank you very much. I am also not confident about Does your implementation try to toggle all contained folds (my current expectation)? Consider this file:
Close |
There is another issue: FastFold and these mappings remap Do you have further insight how one could achieve this? |
Thanks for the idea for zC and zO, they are a great addition to this plugin. Unfortunately my heart isn't in it to try to implement this behavior for zA, or make the plugin play nice with FastFold. I just don't see either being straight forward, or useful enough to motivate me, to work on them. |
I understand. However, I am already quite happy with DocDo you like to add some documentation (doc/fold-cycle.txt, README.md) about I add here examples where the supercharged versions work differently compared to the builtin ones. Demo file
But you still need other commands to open folds individually to profit from several fold levels. Originally, I used the
from http://vim.wikia.com/wiki/Folding However, I now use the
I rarely feel the need for changing the level in the file with If I would still have my old configuration, I could imagine following extended
But I now made the mental shift to use two kinds of commands open and close and stick to the vim way. I think your plugin with the cyclic recursive behavior and the suggested mappings |
@arecarn May I ask you for an extension of the behavior of
I press
Now, I can use
|
Following does what I want nnoremap <silent><expr> zC foldclosed('.')==-1?
\ ':<C-u>call fold_cycle#close_all()<CR>':
\ 'zC'
|
BTW I think for nnoremap zO zvzczO Update nnoremap <silent><expr> zO foldclosed('.')==-1?
\ 'zczO':
\ 'zv'
nnoremap <silent><expr> zC foldclosed('.')==-1?
\ ':<C-u>call fold_cycle#close_all()<CR>':
\ 'zC' (both have a two-step behavior) |
zC
and zA
to all nested foldszC
to all nested folds
I'll reopen this a reminder to take a look at this. |
Vim's default behaviour for
zC
andzA
when closing is that it only closes folds under the cursorline which is always only one line. This is identical tozc
andza
. Only when using visual selection the recursive nature ofzC
can be used.IMHO I would expect a different behavior more similar to your plugin except that
zC
means always closing of the fold of the current cursor and all folds contained in this fold.zA
should follow this pattern when closing except it inverts the current fold and all nested folds.I suspect this should be quite close what your plugin does and could easily be added.
A similar discussion about my intention can be found here:
http://vim.1045645.n5.nabble.com/Folding-recursively-levels-td4848210.html
Update
For consistency one could also change
zO
and as a second option also change visual mode behaviourVim help would look like without visual mode description:
The text was updated successfully, but these errors were encountered: