PracticalVim Tip103 - yszheda/wiki GitHub Wiki

Table of Contents

Tip 103: Navigate Keyword Definitions with Vim's Tag Navigation Commands

Return to the top: <>

Jump to a Keyword Definition

  • `` makes our cursor jump from the keyword under the cursor to the definition.
  • ``: back trace the tag history

References:

Specify Where to Jump to When a Keyword Has Multiple Matches

  • If a tag in the current buffer matches the keyword, it gets the highest priority.

References:

  • `g` command presents a list of choices from the tag match list.

Use Ex Commands

  • `:tag {keyword}`: like ``
  • `:tjump {keyword}`: like `g`

References:

  • can accept a regular expression when used in the form `:tag /{pattern}` or `:tjump /{pattern}`

| Command | Effect | | `` | Jump to the first tag that matches the word under the cursor | | `g` | Prompt user to select from multiple matches for the word under the cursor. If only one match exists, jump to it without prompting | | `:tag {keyword}` | Jump to the first tag that matches {keyword} | | `:tjump {keyword}` | Prompt user to select from multiple matches for {keyword}. If only one match exists, jump to it without prompting | | `:pop` or `` | Reverse through tag history | | `:tag` | Advance through tag history | | `:tnext` | Jump to next matching tag | | `:tprev` | Jump to previous matching tag | | `:tfirst` | Jump to first matching tag | | `:tlast` | Jump to last matching tag | | `:tselect` | Prompt user to choose an item from the tag matching list |

⚠️ **GitHub.com Fallback** ⚠️