问题
After copying my .vimrc file over to windows I noticed there were a lot of problems. I fixed most of them, but I noticed anything with a <CR>
command in it does not work. I just get a "ding" sound.
Here is an example of one command which causes no errors, but doesn't do what it's supposed to. I just get the ding sound
let mapleader = ","
let g:mapleader = ","
nmap <leader>w :w!<cr>
Am I supposed to use something instead fo <CR>
? Note, I did google it
回答1:
I see nothing wrong with your config (well, you probably don't need the duplicate mapleader
definition). I can only imagine problems when you have <CR>
mapped in command-line mode. For this reason, you should use :noremap; it makes the mapping immune to remapping and recursion. To check for problems with mapleader, try invoking via the original leader, i.e. \ W. Also, you can check for your mapping (not being overwritten / cleared) via :verbose nmap <Leader>w
.
来源:https://stackoverflow.com/questions/27676639/adding-carriage-return-in-a-map-instruction-in-gvim