0

The only useful command I found was :help index then navigate to a mode I interested in.

But it explains the whole command list. Is there a function or something else which could give me a simple answer 0 or 1 for a given binding? Or the best I can do is to search through the whole section?

  • 2
    What's wrong with :map? – Sato Katsura Sep 24 '16 at 16:31
1

The commands for creating a mapping, happen to also be the same commands for listing a mapping. From :help map-commands

1.1 MAP COMMANDS                    *:map-commands*

There are commands to enter new mappings, remove mappings and list mappings.
See |map-overview| for the various forms of "map" and their relationships with
modes.

If you call it with both a left hand side, and a right hand side, for example:

nnoremap i iHello<esc>

This creates a new mapping. Now, if you call it with just the left hand side, this will list all mappings that start with that left hand side. For example, if you ran

nmap i

It will list every normal mode mapping that starts with an i. Relevant help section, :h map_l:

:map    {lhs}           |mapmode-nvo|       *:map_l*
:nm[ap] {lhs}           |mapmode-n|     *:nmap_l*
:vm[ap] {lhs}           |mapmode-v|     *:vmap_l*
:xm[ap] {lhs}           |mapmode-x|     *:xmap_l*
:sm[ap] {lhs}           |mapmode-s|     *:smap_l*
:om[ap] {lhs}           |mapmode-o|     *:omap_l*
:map!   {lhs}           |mapmode-ic|        *:map_l!*
:im[ap] {lhs}           |mapmode-i|     *:imap_l*
:lm[ap] {lhs}           |mapmode-l|     *:lmap_l*
:cm[ap] {lhs}           |mapmode-c|     *:cmap_l*
            List the key mappings for the key sequences starting
            with {lhs} in the modes where the map command applies.
            {not in Vi}

The other way to list mappings is if you do not provide a left hand or a right hand side. For example, if you just type:

nmap

this will list every mapping that applies to normal mode. The relevant help section (Not sure how to get here. Just type :h cmapc then scroll down a little):

:map                |mapmode-nvo|
:nm[ap]             |mapmode-n|
:vm[ap]             |mapmode-v|
:xm[ap]             |mapmode-x|
:sm[ap]             |mapmode-s|
:om[ap]             |mapmode-o|
:map!               |mapmode-ic|
:im[ap]             |mapmode-i|
:lm[ap]             |mapmode-l|
:cm[ap]             |mapmode-c|
            List all key mappings for the modes where the map
            command applies.  Note that ":map" and ":map!" are
            used most often, because they include the other modes.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.