7

I've got the following line in my _vimrc file which enables folding for my PHP (and other) files:

set foldmethod=indent

However, whenever I open a file it starts with every fold closed, but I would like the file to start with its folds open.

How can I execute the command zi to open up folds when vim 7.4 is launched?

I tried putting this in the _vimrc but I get a pop up window with the error message:

E492: The following is not an editor command: zi

How do I fix this?

4

zi inverts the option foldenable. Hence, you have to put the following in your .vimrc:

set nofoldenable
2

Add the foldlevel option to your _vimrc:

set foldlevel=20

This opens 20 levels of folds automatically when you open a file.

I am not familiar with the zi command, I just know zR to open all folds from normal mode. In your _vimrc, you generally cannot use normal mode commands to my knowledge.

  • 1
    :help zi plus scrolling up a bit in the help was a useful read. One more command learned :) – cbaumhardt Aug 23 '15 at 18:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.