14

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?

1

2 Answers 2

10

zi inverts the option foldenable. But you don't want to invert it, you want to disable it. So put the following in your .vimrc:

set nofoldenable
9

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.

2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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