How do I select an HTML tag and its contents in Vim?
The vat command visually selects the nearest enclosing HTML or XML tag and all of its contents, including the opening and closing tags themselves.
category:
visual-mode
tags:
#visual-mode
#text-objects
#editing
#normal-mode
How do I force Vim to recompute all folds in the current window?
The zx command resets and recomputes all folds in the current window based on the current foldmethod.
category:
config
tags:
#folding
#normal-mode
#config
How do I pipe a range of lines through an external command and replace them with the output?
The ! operator filters the text covered by a motion through an external shell command, replacing the original lines with the command's stdout.
category:
editing
tags:
#editing
#ex-commands
#normal-mode
#formatting
How do I execute a recorded macro a specific number of times?
Prefix the @ macro-execution command with a count to run the macro that many times in a row.
category:
macros
tags:
#macros
#registers
#normal-mode
#editing
How do I uppercase or capitalize matched text inside a Vim substitution?
Vim's substitute command supports special case-conversion sequences in the replacement string, letting you transform matched text to upper or lower case without
category:
editing
tags:
#editing
#search
#ex-commands
#normal-mode
How do I redraw the screen with the cursor line at center or bottom and move to the first non-blank character?
Vim has scroll-positioning commands that come in two flavors: those that leave the cursor in the current column (zz, zt, zb) and those that also move the cursor
category:
navigation
tags:
#navigation
#normal-mode
#scrolling
How do I move the cursor to the last non-blank character on the current line?
g moves the cursor to the last non-blank character of the current line — skipping trailing spaces and tabs.
category:
navigation
tags:
#navigation
#motions
#normal-mode
How do I create a macro that repeats itself automatically until there is nothing left to process?
A recursive macro calls itself at the end of its own definition, causing it to run repeatedly until Vim hits an error — such as reaching the end of the file o
category:
macros
tags:
#macros
#registers
#editing
#normal-mode
How do I add or remove words from Vim's spell check dictionary?
When Vim's spell checker marks a word as incorrect but it is intentionally spelled that way (a name, abbreviation, or domain-specific term), you can permanently
category:
config
tags:
#config
#spell-check
#editing
#normal-mode
How do I search for a string containing special regex characters like dots or asterisks without escaping them?
Vim's default search mode gives special meaning to characters like .
category:
search
tags:
#search
#regex
#normal-mode
How do I create a mapping that runs an Ex command without switching modes or affecting the current state?
nnoremap <key> <Cmd>command<CR>
The special key (Vim 8.
category:
config
tags:
#config
#macros
#ex-commands
#normal-mode
#insert-mode
How do I jump back to where I last inserted text and continue typing?
The gi command moves the cursor to the position where you last exited insert mode and immediately enters insert mode again.
category:
navigation
tags:
#navigation
#insert-mode
#marks
#normal-mode
#productivity
How do I copy the word under the cursor regardless of cursor position within it?
How it works The command yiw yanks (copies) the inner word under the cursor.
category:
editing
tags:
#editing
#text-objects
#normal-mode
How do I jump back to locations where I previously made edits?
Vim tracks every position where you made a change in the changelist.
category:
navigation
tags:
#navigation
#editing
#normal-mode
#motions
How do I jump between diff hunks when comparing files with Vim's built-in diff mode?
When files are open in Vim's built-in diff mode — whether via vimdiff, :diffsplit, or :diffthis — the ]c and [c motions let you jump precisely between chang
category:
navigation
tags:
#navigation
#diff
#buffers-windows
#normal-mode
How do I jump to the end of a word in Vim?
The e command moves the cursor to the last character of the current word.
category:
navigation
tags:
#navigation
#motions
#normal-mode
How do I copy a line to another location without using yank and paste?
How it works The :t command (short for :copy) copies one or more lines and places them below the specified address.
category:
editing
tags:
#editing
#ex-commands
#normal-mode
How do I jump between method or function definitions in code?
When navigating large source files, ]m and [m let you jump directly to the start of the next or previous method.
category:
navigation
tags:
#navigation
#motions
#normal-mode
#editing
How do I search or substitute only within specific columns of text in Vim?
The \%Nc, \%>Nc, and \%20c — match only after column 20 (i.
category:
search
tags:
#search
#regex
#substitution
#normal-mode
How do I transform or filter a list inline using Vimscript lambdas with map() and filter()?
map() and filter() with lambdas
Vim 8 introduced lambda expressions with the syntax {args -> expr}, enabling concise inline list transformations.
category:
config
tags:
#ex-commands
#normal-mode