How do I choose between multiple tag definitions when jumping to a symbol in Vim?
g<C-]>
When a symbol (function, class, variable) is defined in multiple places, CTRL-] blindly jumps to the first match.
g<C-]>
When a symbol (function, class, variable) is defined in multiple places, CTRL-] blindly jumps to the first match.
[[
The [[ and ]] commands navigate between top-level code blocks — specifically, lines where { appears in column 1.
]'
The ]' command jumps to the start of the line containing the next lowercase mark in the file, while [' jumps to the previous one.
:oldfiles
:oldfiles displays a numbered list of every file Vim has recorded in its viminfo (or shada in Neovim) file.
' vs `
Vim provides two distinct ways to jump to a mark, and they behave differently: the apostrophe ' jumps to the first non-blank character of the marked line, while
'0
Pressing '0 in normal mode jumps to the exact cursor position in the most recently edited file, even after closing and reopening Vim.
g]
g] is the disambiguation-aware alternative to .
mA to set, 'A to jump
Uppercase marks (A–Z) are global marks — they persist across files and Vim sessions.
[[ and ]]
[[ and ]] navigate between section boundaries — typically the start of the previous or next top-level block.
:find
The :find command searches for a file by name across all directories listed in Vim's path option, so you can open files without typing full paths.
]m / [m
Vim's ]m and [m motions navigate between method and function boundaries in curly-brace languages like C, Java, JavaScript, and Go.
'[ and ']
Vim automatically sets two marks whenever you yank, change, delete, or paste text: ` [ ` (backtick-bracket) marks the start of the affected region, and ] ` mark
:set suffixesadd+=.js,.ts,.jsx,.tsx
The gf (go to file) command opens the file under the cursor, but it fails when the path lacks an extension — common in JavaScript/TypeScript imports like impo
navigation #navigation #config #editing #buffers #file-management
:set scrolloff=999
By default, Vim only scrolls the viewport when the cursor reaches the very top or bottom of the screen.
navigation #navigation #scrolling #config #cursor #scrolloff
<C-o>zz
When you are typing in insert mode and the cursor drifts near the top or bottom of the screen, you normally have to press , then zz, then i or a to continue edi
:diffthis
You often have two files open side by side and want to compare them without leaving Vim or launching vimdiff.
:tag /pattern
When working with ctags, you typically jump to exact tag names with .
gp
The standard p command pastes text after the cursor but leaves the cursor at the beginning of the pasted text.
[{ / ]}
When editing code inside a deeply nested block, [{ jumps backward to the unmatched { that encloses the current position, and ]} jumps forward to its matching }.
]m and [m
The ]m and [m motions let you jump forward and backward between the start of method or function definitions.