开发者

In Vim, how to find out what a key combination does

开发者 https://www.devze.com 2023-03-28 00:57 出处:网络
I accidentally press a shorcut key, and I know that vim has do开发者_JAVA百科ne something but I don\'t know what.

I accidentally press a shorcut key, and I know that vim has do开发者_JAVA百科ne something but I don't know what.

How can I find out what that shortcut key does?


There are two potential sources for information. First of all, if it's a built in shortcut, it is normally in the help documentation. For instance, if you do :help CTRL-I, it'll take you to a help entry about moving around your jump list.

It is possible, however, that you have a custom mapping from one of your .vimrc files or an underdocumented plugin. In that case, try using :map which will list all custom keyboard mappings that are currently active. That will give you three columns:

  1. the mode the mapping applies to
  2. the keyboard shortcut
  3. the command that is run

You can then use :help to further investigate the command that is run.


Just doing :map will show you lots of mappings, but if your mapping is F2 or ShiftEnter or CtrlP then the second column (which should show the keyboard shortcut) will be empty.

However you can ask map to tell you what a particular key combination is. Some examples that line up with the above examples:

:map <F2>
:map <S-CR>
:map <C-P>


You might check out the answers at In Vim can I find out what keys I just typed? (If this is what you're looking for).

0

精彩评论

暂无评论...
验证码 换一张
取 消