Vim Tips Wiki
Advertisement

This page lists single unused keys in Vim. As such, it is an inverted version of :help index. In addition, the page lists synonyms that can safely be mapped.

Many more mappings are possible by combining keys. See the article "Follow my leader" in § External links below for hints on combining keys.

In the following table, the type "Free" means a key is not used in Vim by default, whereas the type "Synonym" means a key is used in Vim by default but is a synonym for some other key that is also used in Vim by default so that there is no danger in mapping it.

Key Mode Type Notes
Function keys All modes Free For instance, <F6>.
Alt key combinations All modes Free For instance, <M-q>. Note that mapping alt keys can be problematic depending on the terminal emulator. See e.g. :help :map-alt-keys for more information.
<C-Q> All modes Synonym Synonym for <C-V>. This key is used for flow control on the terminal. On modern machines most people have no use for flow control so you can run stty -ixon in your shell to unlock it for your own use.
<C-S> All modes Free Used for flow control like <C-Q>.
<C-@> Normal Free This can also be entered with <C-Space>.
<C-H> Normal Synonym Synonym for h.
<C-J> Normal Synonym Synonym for j.
<C-K> Normal Free
<C-N> Normal Synonym Synonym for j.
<C-P> Normal Synonym Synonym for k.
<C-[> Normal Free This can also be typed as <Esc>.
<C-_> Normal Free This can also be typed as <C-/>.
+ Normal Synonym Synonym for <CR>.
K Normal By default, this is an inferior version of <Leader>K that can be obtained through man.vim with runtime! ftplugin/man.vim. See :help find-manpage for more.
S Normal Synonym Synonym for cc.
Y Normal Synonym Synonym for yy. However, many people like to map this to y$ to match the behavior of C and D.
_ Normal This is nearly the same as <CR>. The documentation (:help maplocalleader) even mentions the underscore as an example of a key that can be used for the local leader.
s Normal Synonym Synonym for cl.
x Normal Synonym Synonym for dl. However, it is handy to be able to repeat x several times in a row, whereas repeating dl gets cumbersome. (A similar problem does not exist for s and cl, since there is no point in repeating it.)
<Del> Normal Synonym Synonym for x.
<C-@> Visual Free This can also be entered with <C-Space>.
<C-H> Visual Synonym Synonym for h (or <BS> in select mode).
<C-I> Visual Free This is the <Tab> key, which does nothing in visual mode.
<C-J> Visual Synonym Synonym for j.
<C-K> Visual Free
<C-N> Visual Synonym Synonym for j.
<C-O> Visual Free In select mode, this switches to visual mode for one command. Mapping with xnoremap will map it only for visual mode while preserving the default behavior in select mode. See :help mapmode-x for more.
<C-P> Visual Synonym Synonym for k.
<C-R> Visual Free
<C-T> Visual Free
<C-^> Visual Free
<C-_> Visual Free This can also be typed as <C-/>.
& Visual Free
+ Visual Synonym Synonym for <CR>.
. Visual Free
P Visual Synonym Synonym for p.
Q Visual Free
R Visual Synonym Synonym for S. However, the documentation (:help v_R) says "In a next version it might work differently."
Z Visual Free Z in visual mode waits for a following key, as seen if 'showcmd' is set. However, neither ZZ nor ZQ do anything (as in normal mode), and no other key combination is listed in the index, so it appears that Z actually does nothing in visual mode.
_ Visual Nearly the same as <CR>.
s Visual Synonym Synonym for c.
x Visual Synonym Synonym for d.
<Del> Visual Synonym Synonym for d.
<C-B> Insert Free
<C-J> Insert Synonym Synonym for <CR>.
<C-Z> Insert Free Unless 'insertmode' is set.
<C-_> Insert Free This can also be typed as <C-/>.
<C-@> Command-line Free This can also be entered with <C-Space>.
<C-J> Command-line Synonym Synonym for <CR>.
<C-O> Command-line Free
<C-X> Command-line Free
<C-Z> Command-line Free
<C-_> Command-line Free This is only active in default Vim if 'allowrevins' is set, for right-to-left languages.

See also[]

External links[]

Advertisement