I'm trying to make Vim reload its vimrc when I save a file. I have found different solutions, but none of them works for me for some reason.
Vim version: 8.2.2824, OS: Windows 7.
My vimrc:
" I start Vim, type foo, save a buffer as test.txt,
" change colorcolumn to 20, type bar in test.txt, and save it again.
" The colorcolumn doesn't move.
set colorcolumn=5
" version 1
" autocmd! BufWritePost $MYVIMRC execute "normal! :source $MYVIMRC"
" version 2
" autocmd! BufWritePost $MYVIMRC source $MYVIMRC
" version 3
" autocmd! BufWritePost $MYVIMRC source %
" version 4
" augroup reload_vimrc
" autocmd!
" autocmd BufWritePost *.vim,vimrc,$MYVIMRC ++once source $MYVIMRC | e
" augroup END
" There is nothing else.
What is wrong here?
:source $MYVIMRCwould it reload it? – Maxim Kim Sep 11 '21 at 17:59_vimrcwith the same instance of Vim (and not with external editor, Sublime Text), it works. It seems I just messed the whole workflow. So now I accept the answer, thanks. – user90726 Sep 11 '21 at 18:01