These are the vim folding commands that “fold” certain lines in the file in order to help you focus at certain part of it:
zf#j
creates a fold from the Cursor down # lines.zf/string
creates a fold from the cursor to string .zj
moves the cursor to the next fold.zk
moves the cursor to the previous fold.zo
opens a fold at the cursor.zO
opens all folds at the cursor.zm
increases the foldlevel by one.zM
closes all open folds.zr
decreases the foldlevel by one.zR
decreases the foldlevel to zero — all folds will be open.zd
deletes the fold at the cursor.zE
deletes all folds.[z
move to start of open fold.]z
move to end of open fold.
Ex like range commands also work: e.g, “:10,20 fold
” will fold lines 10 through 20.
You may use the following in your ~/.vimrc
file to automatically fold lines when you indent them (for example in a program file):set foldmethod=indent
Reference: Linux.com. You may also find the vim documentation for folds using “:help foldmethod
” while you are looking at a file using vim.
This post first appeared on A Walk In The Rain | My Life And My Thoughts, please read the originial post: here