问题
I've just installed the command-t plugin and what to map it to cmd-t instead of leader-t. I'm fairly new to vim and I don't know what the symbols are for the key mappings. Where can I find a reference for the symbols you use when mapping key combos in vim?
回答1:
a vim principle is that an undocumented feature is a useless feature. So vim documentation is all you need.
:help :map
:help :map-special-keys
回答2:
:help <>
will give you info on the notation used with :map
.
The authors of vim documentation don't always provide links everywhere they ought to (this may not really be practical). 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
. That file is called map.txt
; you can go directly to the top of it with :help map.txt
. The documentation for <>
is located in intro.txt
, which may itself be worth a going-over.
回答3:
Thanks to another SO post and answer, I found the following reference page:
: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
回答4:
D
is the character you need to represent ⌘ in your .vimrc.
For example :
nnoremap <D-t> :MyFunction<CR>
maps ⌘t to MyFunction()
.
Replace MyFunction
by the main function of your plugin and you are set.
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.
来源:https://stackoverflow.com/questions/3803027/vim-key-mapping-reference