如何映射 <C-/>在 vim 中切换评论? [英] How to map <C-/> to toggle comments in vim?

查看:27
本文介绍了如何映射 <C-/>在 vim 中切换评论?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 iterm2 下使用 vim.我正在使用 NERDCommenter 插件,我想使用 Ctrl+/来切换评论(尝试从 Idea/Eclipse 切换到 vim).这是我在 .vimrc 中的映射:

I use vim under iterm2. I'm using the NERDCommenter plugin, and I'd like to use Ctrl+/ to toggle comments (Trying to switch from Idea/Eclipse to vim). This is my mapping in the .vimrc :

 nmap <C-/> <leader>c<Space>
 vmap <C-/> <leader>c<Space>

但是好像不行.可能是什么原因?

But it doesn't seem to work. What can be the reason?

推荐答案

由于某种原因,vim 将 注册为 >(您可以使用 在插入模式下查看它).终端应用程序必须遭受的可能是终端或历史设计问题.

For some reason, vim registers <C-/> as <C-_> (you can see it in insert mode using <C-v><C-/>). It can be the terminal or a historical design thing that terminal apps have to suffer.

而且 Gvim 甚至不会尝试识别 <C-/>.将其视为单个 /.

And Gvim doesn't even try to recognize <C-/>. Sees it as single /.

这篇关于如何映射 &lt;C-/&gt;在 vim 中切换评论?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆