New answers tagged


Put set nofoldenable in your vimrc. This will also accomplish what your autocommand does.


If you're looking to completely disable folding (i.e. open all folds) while typing, see D. Ben Knoble's answer. If you'd just like to prevent Vim from opening and closing folds based on syntax while typing, leaving closed folds closed, check out Vim tip "Keep folds closed while inserting text" or the FastFold plugin. These use a variation on that theme ...


Sure, just disable folding in insert mode, and restore it when you leave: augroup folds au! au InsertEnter * let w:oldfen = &l:foldenable \| set nofoldenable au InsertLeave * \ if exists('w:oldfen') \ let &l:foldenable = w:oldfen \ unlet w:oldfen \ endif augroup END

Top 50 recent answers are included