简体   繁体   中英

Adding carriage return in a map instruction in gVim

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

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, ie \\ W . Also, you can check for your mapping (not being overwritten / cleared) via :verbose nmap <Leader>w .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM