13

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?

Martin Tournoij
  • 62,054
  • 25
  • 192
  • 271
John Sonderson
  • 617
  • 1
  • 6
  • 14

2 Answers2

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
Georg P.
  • 224
  • 1
  • 7
7

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.

cbaumhardt
  • 2,129
  • 17
  • 29