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 foundwhere previously it was being folded. With justfiletype onandfiletype indent on, still no folding (and that error). But as soon as I addfiletype plugin onthe problem returns. – thosphor Aug 26 '16 at 10:11SyntaxtoFiletypewill make it work? This is probably due to the loading order of things... – Martin Tournoij Aug 26 '16 at 14:10Filetypedoesn'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:help :autocmd"in the order in which they were given". This is also repeated later: "Vim executes all matching autocommands in the order that you specify them". – Martin Tournoij Aug 26 '16 at 15:18