5

I added set foldmethod=syntax to my .vimrc, but it automatically folds whenever a new file is opened. Is there a way to prevent auto-folding and just use za to toggle?

ogirginc
  • 345
  • 3
  • 11

1 Answers1

2

As it turns out, I need nofoldenable in .vimrc too:

set foldmethod=syntax
set nofoldenable
ogirginc
  • 345
  • 3
  • 11
  • 1
    You might find 'foldlevelstart' more useful. – Antony May 07 '17 at 19:37
  • 2
    @Antony do you suggest using set foldlevelstart=99? Does it make any difference compared to nofoldenable? Couldn't find any advantages... – ogirginc May 08 '17 at 07:41
  • It's a global option that specifies the starting 'foldlevel' when editing a new file. 'foldenable' is window local and toggles folds on or off.. You can of course use both and toggle 'foldenable' with zi. – Antony May 08 '17 at 10:47