简体   繁体   English

在gVim中的地图指令中添加回车符

[英]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. 将我的.vimrc文件复制到Windows后,我发现有很多问题。 I fixed most of them, but I noticed anything with a <CR> command in it does not work. 我已修复了大多数问题,但是我注意到其中带有<CR>命令的所有内容均不起作用。 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> ? 我应该使用<CR>代替吗? Note, I did google it 注意,我用谷歌搜索过

I see nothing wrong with your config (well, you probably don't need the duplicate mapleader definition). 我认为您的配置没有问题(嗯,您可能不需要重复的mapleader定义)。 I can only imagine problems when you have <CR> mapped in command-line mode. 我只能想象当您在命令行模式下映射<CR>时出现问题。 For this reason, you should use :noremap ; 因此, 您应该使用:noremap ; it makes the mapping immune to remapping and recursion. 它使映射不受重新映射和递归的影响。 To check for problems with mapleader, try invoking via the original leader, ie \\ W . 要检查mapleader的问题,请尝试通过原始引线(即\\ W)调用。 Also, you can check for your mapping (not being overwritten / cleared) via :verbose nmap <Leader>w . 另外,您可以通过:verbose nmap <Leader>w检查映射(不被覆盖/清除)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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