Monday, March 11, 2013

vim: fold all siblings

I've been trying most zKEY s , but haven't found one to effectively fold all siblings (but not to close upto the parent fold).
I know zm , zc, zC, but they are not doing what I meant...

think about this:

    {
        interface fxp0.0 {
            disable;
        }
        interface lo0.100 {
            disable;
        }
        interface lo0.200 {
            disable;
        }
    }

1) I start by unfold them all:
+   2 +-- 11 lines: {

2) now I unfold them, I can see all sub-folds:

-   2     {                           
|+  3 +---  3 lines: interface fxp0.0 
|+  6 +---  3 lines: interface lo0.100
|+  9 +---  3 lines: interface lo0.200
|  12     }                           

3) now I go ahead and unfold fxp0.0:

-   2     {                               
-   3         interface fxp0.0 {          
2   4             disable;                
2   5         }                           
|+  6 +---  3 lines: interface lo0.100    
|+  9 +---  3 lines: interface lo0.200    
|  12     }                               

4) now, my cursor is in line3 , I'm in 1st sub-fold, and I have 2 siblings.
say I may have 50+ sibings in here and some are folded some unfolded.
how can I fold all slibings from here?

zc on each unfolded sub-fold is too much work
zC,zm,zM will close everything upto step 1

what I wanted is, make sure the parent fold is still unfolded, while just unfold all sibling folds...
if you ever use VOom plugin, its zC do exactly what I meant, but only in the tree view...


regards
ping

No comments: