I was editing my vimrc, and decided to remove a mapping based on some information I found on
<cr>. So I deleted the mapping and called my
:SourceVimrc command (
command SourceVimrc source $MYVIMRC). To my surprise, when I pressed enter, it still performed the deleted mapping. I had to open a new session for the mapping to disappear.
I found the
:scriptnames command, and that indicated to me that it was correctly loading the vimrc:
1: ~/.config/nvim/init.vim 2: ~/.vimrc
So I added a new mapping for
<cr> to make sure that sourcing works:
nnoremap <cr> <cr><cr>, and that was loaded correctly.
I checked "Learn Vimscript the Hard Way", because I thought I remembered something there, but didn't find it if it is. On StackOverflow and here I didn't see this mentioned, although I'm surprised because I'm sure this is a question someone has asked before.
- Is this correct? Does
:source $MYVIMRCnot remove mappings?
- If this is true, can I change my command to remove all old mappings?