Is it possible to apply vim configurations without restarting?
Solution 1:
Yes, just use the :so %
command while editing your .vimrc.
If you want vim to auto-reload your configuration, you must add the following commands :
augroup myvimrchooks
au!
autocmd bufwritepost .vimrc source $MYVIMRC
augroup END
the grouping of autocommand is here to avoid "exponential" reloading if you save several times your configuration.
Solution 2:
Here's a more cross-platform compatible version if you run on Mac/Windows/Linux and gvimrc
:
augroup myvimrc
au!
au BufWritePost .vimrc,_vimrc,vimrc,.gvimrc,_gvimrc,gvimrc so $MYVIMRC | if has('gui_running') | so $MYGVIMRC | endif
augroup END
The autocmd watches all potential *vimrc
files and when one changes, it reloads the vimrc
file followed by gvimrc
if the GUI is running.
Solution 3:
source your vimrc file :source ~/.vimrc