I wanted to have my vimrc automatically update when I write to a .vim file using this autocmd:
autocmd BufWritePost *.vim,$MYVIMRC source $MYVIMRC
But for some reason when I have this enabled and then do :w
in my vimrc, my vimrc is pasted into my current buffer at the cursor position. How can I prevent this, and why does source
behave like this?
:source $MYVIMRC
manually, does this happen? If so, its probably a bug in your vimrcaugroup reload_vimrc | autocmd! | autocmd BufWritePost *.vim,vimrc,$MYVIMRC ++once source $MYVIMRC | e | augroup END