How do I pick from multiple tag matches instead of jumping to the first one?
Answer
g]
Explanation
g] is the disambiguation-aware alternative to <C-]>. When the word under your cursor has multiple tag definitions (overloaded functions, multiple files with the same symbol), g] presents a numbered list of all matches and lets you choose which one to jump to.
How it works
<C-]>— jump immediately to the first (highest-priority) tag matchg]— show all tag matches in a list, prompt for a number, then jump:tselect {name}— same asg]but for an arbitrary name instead of cursor word:tjump {name}— jumps directly if there's only one match, shows the list if there are multiple
Example
With cursor on parseConfig, pressing g] displays:
# pri kind tag file
1 F f parseConfig src/config.c
2 F f parseConfig src/legacy.c
3 F m parseConfig lib/util.go
Enter nr of choice (<CR> to abort):
Type 2<CR> to jump to the definition in legacy.c.
Tips
- After jumping, use
<C-t>to return to the previous location in the tag stack :tprevand:tnextcycle through tag matches without the picker — useful if you already know the order:tagsshows your full tag stack so you can see how deep you've navigated- For LSP-aware projects in Neovim,
g]still works with:help tagsrchbut you may prefervim.lsp.buf.references()for cross-file accuracy