I have the following on my vimrc file to handle custom folding:
" ++ Folding set foldenable " enable folding set foldmethod=syntax " global folding method set foldlevelstart=1 " folds with level 1 aren't closed augroup FileTypeVim autocmd! autocmd FileType vim setlocal foldmethod=expr foldexpr=VimrcFold() augroup END
When I open my vimrc it works perfectly fine. However, if I re-source my vimrc the foldmethod is set to syntax (global) instead of expr (specific for filetype vim). What do I have to specify in order to keep the vimrc with expr foldmethod? I suspect it has to be with BufType rather than FileType but I am not sure how to deal with that.