4 years ago
This causes vim to automatically re-source and apply changes to your vimrc when the buffer is saved. Really handy when testing new mappings (or adding new snippets!).
" Automatically source vimrc on save. autocmd! bufwritepost $MYVIMRC source $MYVIMRC
KabbAmine 4 years ago
In a more dynamic way, you can use
$MYVIMRC instead of
autocmd! bufwritepost $MYVIMRC source $MYVIMRC
Chris Penner 4 years ago
Good point, I made it halfway and apparently just didn't complete the thought. Swapped it out.
Sérgio Luiz Araújo Silva 1 year ago
I would love to know how to do this withou moving my cursor
Rahul Gupta 2 months ago
Very useful, thanks guys ! For neovim i used this:
autocmd! bufwritepost ~/.vimrc source $MYVIMRC
Because my $MYVIMRC points to ~/.config/nvim/init.vim
source ~/.vimrc internally.