How do I jump to the enclosing curly brace or parenthesis in code?
[{ / ]}
When editing code inside a deeply nested block, [{ jumps backward to the unmatched { that encloses the current position, and ]} jumps forward to its matching }.
[{ / ]}
When editing code inside a deeply nested block, [{ jumps backward to the unmatched { that encloses the current position, and ]} jumps forward to its matching }.
:vimgrep /pattern/ %
When you need to find all occurrences of a pattern in the current file and jump between them systematically, :vimgrep with % is more powerful than basic / searc
]m and [m
The ]m and [m motions let you jump forward and backward between the start of method or function definitions.
:.+1,.+3d
Vim's Ex command addresses support arithmetic offsets relative to the current line (.
command-line #ex-commands #editing #navigation #command-line
dp and do
When comparing two files side by side in Vim's diff mode (:diffsplit or vim -d file1 file2), you often want to accept or push individual changes between the fil
:ilist /pattern/
The :ilist command searches for a pattern not only in the current buffer but also in files referenced by #include directives (or whatever 'include' is set to).
g<C-g>
While shows basic file info (filename, line count, position), g provides a much more detailed statistical breakdown of your file or visual selection.
:keepjumps
When writing scripts or running commands that move the cursor (like :g, :s, or :normal), Vim normally adds each cursor position to the jump list.
:ls +
The :ls command (or :buffers) supports filter flags that narrow the buffer list to specific states.
]m / [m / ]M / [M
When navigating large source files, ]m and [m let you jump directly to the start of the next or previous method.
o (in Visual mode)
When you make a Visual selection in Vim, the cursor sits at one end while the other end is anchored.
K
Pressing K in normal mode runs a lookup program on the word under the cursor.
navigation #navigation #help #documentation #normal-mode #keywordprg
:ptag function_name
The :ptag command opens a tag definition in a small preview window at the top of the screen, letting you read the definition without losing your place in the cu
buffers-windows #buffers #windows #tags #preview #navigation
<C-w>z or :pclose
The preview window shows file contents temporarily without switching your editing context.
buffers-windows #buffers-windows #quickfix #preview #navigation
:lua require('harpoon.ui').toggle_quick_menu()
Harpoon by ThePrimeagen lets you mark a small set of files (typically 4-6) and instantly switch between them with dedicated keybindings.
zz / zt / zb
Vim's z scroll commands reposition the screen relative to the cursor without moving the cursor itself.
navigation #navigation #scrolling #viewport #cursor-position
( ) { } [[ ]]
Vim provides structural navigation motions that move by sentences, paragraphs, and sections.
:pop or <C-t>
When you jump to a tag definition with , Vim pushes your location onto a tag stack.
w vs W, b vs B, e vs E
Vim distinguishes between "words" (sequences of keyword characters) and "WORDS" (sequences of non-blank characters).
gj and gk
When wrap is enabled, long lines wrap across multiple screen lines.