" Quickly edit/reload this configuration file nnoremap gev :e $MYVIMRC<CR> nnoremap gsv :so $MYVIMRC<CR>
To automatically reboot on save, add the following to your $MYVIMRC :
if has ('autocmd') " Remain compatible with earlier versions augroup vimrc " Source vim configuration upon save autocmd! BufWritePost $MYVIMRC source % | echom "Reloaded " . $MYVIMRC | redraw autocmd! BufWritePost $MYGVIMRC if has('gui_running') | so % | echom "Reloaded " . $MYGVIMRC | endif | redraw augroup END endif " has autocmd
and then for the last time type:
:so %
The next time you save vimrc , it will automatically restart.
Features:
- Tells the user what happened (also logged in
:messages ) - Handles various names for configuration files
- Ensures compliance only with the actual configuration file (ignores copies in other directories or
fugitive:// diff) - Will not generate an error when using
vim-tiny
Of course, an automatic reboot will only happen if you change your vimrc to vim.
Tom Hale Sep 02 '16 at 14:12 2016-09-02 14:12
source share