I've added the following lines to my .vimrc after reading about folding the other day (taken from vim.wikia.com):
autocmd Syntax html,python,tex setlocal foldmethod=indent
autocmd Syntax html,python,tex normal zR
I wanted indented folds enabled, but to be open when I first open a file. However, when I open a python file all the folds are closed, and when I open a .tex file all the folds are open.
Does anyone know what the problem is here?
E490: No fold found
where previously it was being folded. With justfiletype on
andfiletype indent on
, still no folding (and that error). But as soon as I addfiletype plugin on
the problem returns. – thosphor Aug 26 '16 at 10:11Syntax
toFiletype
will make it work? This is probably due to the loading order of things... – Martin Tournoij Aug 26 '16 at 14:10Filetype
doesn't help, try putting both commands in a single autocmd (or better, in ftplugins):autocmd Filetype html,python,tex setlocal foldmethod=indent | normal zR
. This is just a hunch, but I don't know if Vim offers any guarantees about what order autocmds will be triggered in. – Rich Aug 26 '16 at 14:57