One minute read
If you find yourself always executing
:so after every
vimrc change, put this
autocmd! bufwritepost .vimrc source %
This causes Vim to automatically source and apply your changes to your
the buffer is saved.
It will be better option to use variable, since your
.vimrc file may be
different: For instance if you use NeoVim your
rc file is
" Automatically source vimrc on save. autocmd! bufwritepost $MYVIMRC source $MYVIMRC
I want to see a confirmation from Vim after my file sourced to ensure everything is OK. In order to make this happen you can use below snippet:
autocmd! BufWritePost $MYVIMRC source $MYVIMRC | echom "Reloaded $NVIMRC"