Detect if key is bound to something in vim

I would like to know if there is a way to find out if the key is doing something in vim. I know that I can use :map to view custom mappings, but is there something for the inline stuff?

For example, I always had CTRL - W associated with closing a tab because I thought it was not used. Six months later, I found out that there are some sequences that use it, for example CTRL - W CTRL - S to break a window, and it was a nightmare to relearn.

+78
vim key-bindings
Mar 20 '10 at 16:44
source share
7 answers

If you check out Randy Morris's suggested answer, you will find that

 :help index 

will give you the list you want.

+71
Mar 20 '10 at 18:06
source share

To check the default display:

 :help index 

For another mapping, which is performed either by users or by a plugin:

 :map :map! 

From http://vim.wikia.com/wiki/Mapping_keys_in_Vim_-Tutorial (Part_1) :

The first command displays cards that work in normal, visual and operator selection and standby mode. The second command displays cards that work in input mode and command line.

As a rule, the output of the above commands will span several pages. You can use the following set of commands to redirect output to the vim_maps.txt file:

 :redir! > vim_maps.txt :map :map! :redir END 
+35
Apr 20
source share

Not a complete answer, but you can check :help map-which-keys list of keys that vim recommends using on their custom maps.

This help topic has recommendations on how to determine if a specific key is displayed for an action.

+30
Mar 20 '10 at 17:03
source share

Usage :map! and :map for manually installed keys and :help 'char(-combination)' to find out which keys are already matched in vim from the box (/ from your specific compilation options). (A little off topic, but still respectable (I think): Use :scriptnames to see which files were received in which order.)

+16
Jan 18 '11 at 10:23
source share

I looked through the :help index and compiled a list of some unused nmap keys:

  • Q (switch to "Ex" mode)
  • Z except ZZ, ZQ
  • \
  • <Space> (same as l in normal mode; the largest and least used key in normal mode)
  • gb, gc, gl, gx, gy, gz
  • gf (dream)
  • zp, zq, zu, zy
  • cd, cm, co, cp, cq, cr, cs, cu, cx, cy
  • dk, dm, do, dp, dk, dr, ds, do, dx, dm
  • gA, gB, gC, gG, gK, gL, gM, gO, gS, gX, gY, gZ
  • ZB, ZI, ZJ, ZK, ZP, ZQ, ZP, ZS, ZT, ZU, ZV, ZY, ZZ
  • ] a,] b,] e,] g,] h,] j,] k,] l,] n,] o,] q,] r,] t,] u,] v,] w,] x ,] y
  • [a, [b, [e, [g, [h, [j, [k, [l, [n, [o, [q, [r, [t, [u, [v, [w, [x ], [y
  • CTRL-G, CTRL-K
  • CTRL- \ a - z (reserved for extensions)
  • CTRL- \ A - Z (not used)

Please update / comment.

+14
Feb 06 '16 at 17:44
source share

You can use mapcheck .: -

For example, I wanted to match <CR> ,i with gg=G with the indented file. To check if there is a mapping already for <CR> , i

 if mapcheck("\<CR>", "I") == "" |echo "no mapping" 

... but this will not determine if the mapping is part of the sequence.

+9
Nov 01. '13 at 12:34
source share

In the spirit of the response of Michal Chemistry, see also:

https://vim.fandom.com/wiki/Unused_keys

This indicates several bindings that he did not mention, especially bindings that exist but are relatively obscure / worthless. However, this is not complete either.

-2
Jun 14 '19 at 13:27
source share



All Articles