How do I jump between function or section boundaries in Vim?
[[ and ]]
[[ and ]] navigate between section boundaries — typically the start of the previous or next top-level block.
Search Vim Tricks
Searching...[[ and ]]
[[ and ]] navigate between section boundaries — typically the start of the previous or next top-level block.
"/
Vim stores the last search pattern in the special / register.
<C-a> (insert mode)
While in insert mode, pressing re-inserts the exact text you typed during your previous insert session.
"-
Vim silently stores every deletion of less than one line in the special "- register (the "small delete" register).
:let @q =
Instead of recording a macro with q, you can assign any string directly to a named register using :let @{register} = 'keys'.
:earlier
Vim's undo history is not just a linear list of changes — it records timestamps too.
: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.
:tab split
:tab split opens the current buffer in a brand new tab page, giving you a second independent view of the same file.
!{motion}{command}
The ! operator filters the text covered by a motion through an external shell command, replacing the original lines with the command's stdout.
zx
The zx command resets and recomputes all folds in the current window based on the current foldmethod.
:keeppatterns %s/old/new/g
The :keeppatterns modifier runs any Ex command without modifying Vim's last search pattern (stored in @/).
command-line #search #ex-commands #command-line #substitute #registers
@"
Vim macros are stored in registers — and you can execute any register as a macro with @{register}.
:norm
:normal (abbreviated :norm) executes a sequence of normal-mode keystrokes on each line of an address range.
:t
The :t command (short for :copy) copies addressed lines to a destination line number, leaving the unnamed register untouched.
[p
When you copy code from one indentation level and paste it at another, p preserves the original indentation, leaving your code misaligned.
:argdo norm @a | update
Combining :argdo with :norm @a lets you apply a recorded macro to every file in Vim's argument list — a powerful pattern for bulk refactoring across a project
<C-x>s
When spell checking is enabled (:set spell), s in insert mode opens a popup menu of suggested corrections for the most recently flagged misspelled word — with
:%!
The ! operator pipes text through a shell command, replacing the selected lines with the command's output.
:call setreg('"', @", 'l')
Vim registers carry not just their text content but also a type: charwise (c), linewise (l), or blockwise (b).
p (in visual mode)
In visual mode, pressing p replaces the selected text with the contents of the default register.