My boot time for vim is about a half second (tested with \"--startuptime\"), but after I reload vimrc a couple times via source
, it gets slower subsequently. I have
This is my solution that also clears previous mappings:
augroup VimrcGroup
autocmd!
" Make changes effective after saving .vimrc. Beware that autocommands are
" duplicated if .vimrc gets sourced again, unless they are wrapped in an
" augroup and the autocommands are cleared first using 'autocmd!'
autocmd bufwritepost $MYVIMRC call OnSavingVimrc()
augroup END
" Avoid infinite loops
if !exists("*OnSavingVimrc")
function! OnSavingVimrc()
" Clear previous mappings, they don't go away automatically when sourcing vimrc
mapclear
echo "Sourcing Vimrc after saving it"
source $MYVIMRC
endfunction
endif