I want to edit .vimrc
file from Vim and apply them without restarting Vim.
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.