Vim Folding – Linux VIM

Video is ready, Click Here to View ×

Vi Improved, a highly configurable, improved version of the vi text editor

Vim folding commands
zf#j creates a fold from the cursor down # lines.
zf/string creates a fold from the cursor to string .
za When on a closed fold: open it.and vice-versa.
zA When on a closed fold: open it recursively.and vice-versa.
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…


  1. I have this one file that every time I open it there are two folds that I don't remember adding so I have to open them every time I open the file. I don't know how to get rid of them. I don't want them there.

  2. gotbletu posted the way he does it in the description. Just expand it and go down to the pastie. No need to guess. Also, why would you want to edit the default file for the package in /etc instead of /root/.vimrc or $HOME/.vimrc?

  3. Very useful info!

    I will typically include a comment with a brief explanation above a code block, in which case I can fold all of the code below for the particular function or block.

  4. To me it looks like he just created an alias in either his ~/.bashrc (or sourcing ~/.bash_aliases in ~/.bashrc) as such: alias vimrc="sudo vim /etc/vim/vimrc". I tested it in bash and it worked just fine. Made one for both vimrc and bashrc. I have some pretty useful aliases if you need just let me know.

  5. oh yea just a junk file i have for dumping any new alias/functions, ill paste in the video box if u need, is for bash tho so u might have to make a script to call on it if ur on zsh

  6. Man, I gotta know what that file is that you are doing the demo on. It looks very interesting. Especially that if statement for calling vim as root if editing a root file. Is that a custom config you made? At first I thought it was something that you put in your .zshrc; but in the video it is clearly going to a plugin directory. Anyways, can you share it please?

  7. i have alot of those vids, u can check out my old ones, it just depends on what desktop env or apps you are using, or u can watch the playlist it breaks it into categories. Otherwise if u have a specific question then maybe i can answer it.

  8. hey,can you do some videos on tweaking the os ? please?i see you have knowledge and curiosity of hidden functionalities instuff,but considering that your computer looks heavily tweaked….could you try and make some vids on how to improve it ,or how do you administrate your machine?Thankw alot in advance .Cheers

Leave a Reply

Your email address will not be published.