I tried searching for this on the internet but I get bombarded with answers saying to :so $MYVIMRCwhich does not work if I add lines of the type autocmd FileType foo bar.

What's a more efficient way to apply the effects instead of opening .vimrc, closing vim and then opening the file I was editing again?


FileType autocommands are triggered when the filetype option is set. Hence to reload an autocmd you added/edited, after :so $MYVIMRC, you should do something like

:set ft=<your filetype>

on the target file. As a mapping to do that automatically :

noremap <leader>rft :exe ':set filetype='.&filetype<CR>
  • Or :w | e (edit triggers the events too) – D. Ben Knoble Jul 14 '19 at 13:35

Not the answer you're looking for? Browse other questions tagged or ask your own question.