16

Possible Duplicate:
vim: enable folds but don't automatically close them

Whenever I open Vim, it automatically folds everything. So the first thing I invariably do is to unfold everything.

Is there a way to automate this?

41

To unfold all folds, use the keys

zR

In order to adjust the initial fold level, play around with the foldlevel, e.g.

:set foldlevel=1

will open all the highest level folds, a very high number will thus open all folds. Find out which level 1, 2, 3, ... is the one you want.

To make this static, edit your ~/.vimrc and add:

set foldlevelstart=1

duplicate of this question.

| improve this answer | |
  • 7
    In case someone is wondering how to fold all folds: zM – Jayaram R Oct 4 '14 at 22:03
  • What does zM stands for? – luis.espinal May 16 '18 at 18:46
  • To disable folding entirely, use set nofoldenable. – dfarrell07 Dec 14 '18 at 20:42
  • @luis.espinal zR probably stands for reduce folding while zM stands for more folding. – scai Nov 8 '19 at 11:35

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