Adding carriage return in a map instruction in gVim

蹲街弑〆低调 提交于 2019-12-24 17:29:42

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!