Is there any way to view the currently mapped keys in Vim?
Solution 1:
You can do that with the :map
command. There are also other variants.
-
:nmap
for normal mode mappings -
:vmap
for visual mode mappings -
:imap
for insert mode mappings
The above list is not complete. Typing :help map
in Vim will give you more info.
Solution 2:
:redir! > vim_keys.txt
:silent verbose map
:redir END
This outputs the shortcuts, with where they were defined, to a text file.
Solution 3:
In addition to answers about :map
with no arguments: do not miss its verbose form (:verbose map
) which shows where the mapping(s) was defined (see :help map-verbose
).
Solution 4:
Quite simply, just run the :map
variants with no arguments.
:map
:imap
:vmap
Solution 5:
:map
and its friends are the key, :verbose
adds info and :redir
allow post-search refinement.
They are a perfect mix to show what command is bind to what shortcut and viceversa, but if you want to search some keys and avoid temp files whenever you need to search mappings, take a look to scriptease and :Verbose
command.
It is a wrapper on :verbose
to show result in a preview window.
this way you can search whatever you want inside results without using temp files
type :Verbose map
and use / ? as usual.