I'm using spf13-vim, and I wanted to keep my vimrc folded into sections like this

+------126 lines: Environment {----------------------------------------------------------------------------------------------------------------------------------------------------------------------

I figured out how to do it using visual (vjjjjjjjj...) and zf/za, but how do I make it permanent so I can toggle each part open or close any time I open the file?

I tried using markers, but it doesn't seem to work how I want (ends up folding 2-4 lines instead of the 124 lines I want)

Here are my fold settings

foldmarker={,} foldlevel=0 foldmethod=marker

1 Answer 1


For a single file (like ~/.vimrc), I would configure the folding via a modeline; i.e. a special comment at the end of the file that Vim recognizes and sets the fold-related options accordingly. Note: I wouldn't use {,} as fold markers, as those also occur in Vimscript (to define Dictionary objects); better stick to the original ones:

" vim: set fdm=marker fmr={{{,}}} fdl=0 :

You would then introduce the folding blocks like this:

" Environment {{{

Why your global fold settings don't work, I don't know. It may be caused by spf-13. Vim "distributions" like spf-13 and Janus lure you with a quick install and out-of-the-box settings, but you pay the price with increased complexity (you need to understand both Vim's runtime loading scheme and the arbitrary conventions of the distribution) and inflexibility (the distribution may make some things easier, but other things very difficult). Vim is incredibly customizable, using someone else's customization makes no sense.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .