Wednesday, 24 February 2010
VIM Folding Away Unwanted Text/code
I've only just started using folding but how did I live without it before and it's so EASY! You make sections of the code you are uninterested in "disappear" with a fold or several folds. Of course many editors have folding but VIM combines folding with the power of its motion commands, you can even use regex!
" folding : hide sections to allow easier comparisons
zf} : fold paragraph using motion
v}zf : fold paragraph using visual
zf'a : fold to mark
zo : open fold
zc : re-close fold
:help folding
the folds I used
a) move to beginning of code I wish to work on and everything before
zf1G : fold all lines from current line to beginning of the file
a) move to end of code I wish to work on and everything after
zfG
zf} : fold paragraph using motion
v}zf : fold paragraph using visual
zf'a : fold to mark
zo : open fold
zc : re-close fold
:help folding
the folds I used
a) move to beginning of code I wish to work on and everything before
zf1G : fold all lines from current line to beginning of the file
a) move to end of code I wish to work on and everything after
zfG
Labels: folding, matchit.vim
Subscribe to Posts [Atom]
Post a Comment