This question already has an answer here:

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?

marked as duplicate by filbranden, peterh, Herb Wolfe, muru, statox Jul 18 at 14:14

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.


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 at 13:35

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