6

I ran :help index to find out about key mappings and it's great, but there's one thing I don't get. At the top it says...

This file contains a list of all commands for each mode, with a tag and a short description.

Indeed, the leftmost column of information in each section is "tag".

So e.g., the first thing is...

tag             char            action in Insert mode
-------------------------------------------------------------------------
i_CTRL-@        CTRL-@          insert previously inserted text and stop

What is the nature and purpose of the tag i_CTRL-@?

Does it do something useful I should know about?

Nafine
  • 63
  • 2

1 Answers1

8

The tag is useful for two things:

  1. When using the :help command, the tag is the exact phrase which will let you distinguish between similar terms.

                                                    {subject} E149 E661
    :h[elp] {subject}       Like ":help", additionally jump to the tag {subject}.
    

    For example, <c-A> is available in insert, normal and command-line modes. To get to the help entry for:

    • insert mode, do :h i_CTRL-A.
    • normal mode, do :h CTRL-A.
    • command-line mode, do :h c_CTRL-A.
  2. You can use them for tag navigation. From :h tags:

    With the ":tag" command the cursor will be positioned on the tag.  With the
    CTRL-] command, the keyword on which the cursor is standing is used as the
    tag.  If the cursor is not on a keyword, the first keyword to the right of the
    cursor is used.
    

    So, when on a tag, you can press <c-]> to jump to where the tag is defined, which is where the full help for that entry will be present. For example, in the list you show, if you move to i_CTRL-A and press <c-]>, you'll get to:

                                                    i_CTRL-@
    CTRL-@          Insert previously inserted text and stop insert.  {Vi: only
                    when typed as first char, only up to 128 chars}
    

    And you can press <c-T> to jump back to where you were.


See also: points 6 and 9 in this excellent answer about the help system.

muru
  • 24,838
  • 8
  • 82
  • 143