简体   繁体   English

vim键映射引用

[英]vim key mapping reference

I've just installed the command-t plugin and what to map it to cmd-t instead of leader-t. 我刚刚安装了命令-t插件以及将它映射到cmd-t而不是leader-t的内容。 I'm fairly new to vim and I don't know what the symbols are for the key mappings. 我对vim相当新,我不知道键映射的符号是什么。 Where can I find a reference for the symbols you use when mapping key combos in vim? 在vim中映射关键组合时,我在哪里可以找到您使用的符号的参考?

a vim principle is that an undocumented feature is a useless feature. vim原则是未记录的特征是无用的特征。 So vim documentation is all you need. 所以你需要的是vim文档。

:help :map
:help :map-special-keys

Thanks to another SO post and answer , I found the following reference page: 感谢另一个SO帖子和答案 ,我找到了以下参考页面:

:help key-notation

Here's an excerpt: 这是一段摘录:

<S-...>     shift-key                       *shift* *<S-*
<C-...>     control-key                     *control* *ctrl* *<C-*
<M-...>     alt-key or meta-key             *meta* *alt* *<M-*
<A-...>     same as <M-...>                 *<A-*
<D-...>     command-key (Macintosh only)    *<D-*
<t_xx>      key with "xx" entry in termcap

:help <> will give you info on the notation used with :map . :help <>将为您提供有关使用的符号的信息:map

The authors of vim documentation don't always provide links everywhere they ought to (this may not really be practical). vim文档的作者并不总是提供他们应该到处的链接(这可能不太实际)。 Often you end up having to read an entire help file, or at least the first few sections, to get the foundation for what is being explained in a particular entry. 通常,您最终必须阅读整个帮助文件,或者至少是前几节,以便为特定条目中的解释提供基础。

In this case, I found a link to <> in the very first section of the file which contains the info for :help map-special-keys . 在这种情况下,我在文件的第一部分找到了一个指向<>的链接,其中包含以下信息:help map-special-keys That file is called map.txt ; 该文件名为map.txt ; you can go directly to the top of it with :help map.txt . 您可以使用以下命令直接转到顶部:help map.txt The documentation for <> is located in intro.txt , which may itself be worth a going-over. <>的文档位于intro.txt ,本身可能值得一试。

D is the character you need to represent in your .vimrc. D是您在.vimrc中表示所需的字符。

For example : 例如 :

nnoremap <D-t> :MyFunction<CR>

maps t to MyFunction() . 地图 MyFunction()

Replace MyFunction by the main function of your plugin and you are set. 通过插件的主要功能替换MyFunction并设置好。

Another way would be to look at the plugin's file and see if you can modify some hardcoded mappings. 另一种方法是查看插件的文件,看看是否可以修改一些硬编码映射。

Another thing to do — the first, I think — would be to consult the plugin's help and see if a "canonical" mapping method is indicated or if there is some variable to put in your .vimrc. 另一件事 - 第一,我认为 - 将参考插件的帮助,看看是否指示了“规范”映射方法,或者是否有一些变量放在你的.vimrc中。

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

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