Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

vim

I accidentally press a shorcut key, and I know that vim has done something but I don't know what.

How can I find out what that shortcut key does?

like image 721
McBear Holden Avatar asked Aug 13 '11 00:08

McBear Holden


People also ask

How do you check if a key is mapped in vim?

Use :map! and :map for manually set keys and :help 'char(-combination)' to find out which keys are already mapped in vim out-of-the-box(/out of your specific compiling options).

How do I map a function key in vim?

You can use the <expr> attribute to a map command to invoke a Vim function and use the returned value as the key sequence to execute. For example, the following code creates a normal mode map to change to the directory of the current buffer.

What is the silent key in vim?

<silent> tells vim to show no message when this key sequence is used. <leader> means the key sequence starts with the character assigned to variable mapleader -- a backslash, if no let mapleader = statement has executed yet at the point nmap executes.

Does vim allow for custom key bindings?

Creating a set of key bindings that is familiar, eases the learning curve of any new editor, and the flexibility vim allows in this configuration makes it easy to not only leverage the power of vim, but also make it feel like a familiar old friend.


1 Answers

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.

like image 119
Conspicuous Compiler Avatar answered Nov 16 '22 01:11

Conspicuous Compiler