How do I quickly comment and uncomment code in Vim with a plugin?
The vim-commentary plugin by Tim Pope provides a minimal yet powerful way to toggle comments in any programming language.
category:
plugins
tags:
#plugins
#commentary
#commenting
#editing
#normal-mode
How do I rapidly generate HTML boilerplate using abbreviations in Vim?
The emmet-vim plugin brings the full power of Emmet (formerly Zen Coding) to Vim, letting you type a short CSS-like abbreviation and expand it into a complete H
category:
plugins
tags:
#plugins
#emmet
#html
#css
#editing
#insert-mode
How do I swap two text regions without using a temporary register in Vim?
The vim-exchange plugin by Tom McDonald provides the cx operator to swap two arbitrary text regions.
category:
plugins
tags:
#plugins
#exchange
#editing
#text-objects
#refactoring
How do I quickly convert between snake_case, camelCase, and other naming conventions in Vim?
The vim-abolish plugin by Tim Pope provides instant case coercion commands that convert the word under your cursor between common naming conventions.
category:
plugins
tags:
#plugins
#abolish
#editing
#refactoring
#naming
How do I yank text into a specific named register for later use?
Vim has 26 named registers (a-z) that act as independent clipboards.
category:
registers
tags:
#registers
#editing
#normal-mode
#yank
#productivity
How do I search and replace only whole word matches, not partial matches?
Wrapping your search pattern in \ word boundary anchors ensures that Vim only matches the exact whole word, preventing accidental replacements inside longer wor
category:
search
tags:
#search
#substitution
#regex
#ex-commands
#editing
How do I search and replace with confirmation for each match?
Adding the c flag to a substitute command makes Vim pause at every match and ask you whether to replace it.
category:
search
tags:
#search
#substitution
#ex-commands
#editing
How do I quickly surround a word with quotes, brackets, or parentheses?
Vim doesn't have a built-in "surround" operator, but you can wrap any word in quotes or brackets with a short sequence: ciw""P.
category:
editing
tags:
#editing
#text-objects
#normal-mode
#productivity
#surround
How do I swap a word with the contents of a register using visual mode?
The viwp command visually selects the word under the cursor and replaces it with the contents of the unnamed register (your last yank or delete).
category:
visual-mode
tags:
#editing
#visual-mode
#registers
#paste
#productivity
How do I toggle the case of an entire word in Vim?
The g~iw command toggles the case of every character in the word under the cursor — uppercase letters become lowercase and vice versa.
category:
editing
tags:
#editing
#text-objects
#case
#normal-mode
How do I revert a file to its state from a specific time ago?
:earlier {time} / :later {time}
Vim's :earlier and :later commands let you navigate the undo history by wall-clock time rather than by individual undo steps.
category:
editing
tags:
#editing
#undo-redo
#ex-commands
#advanced
#productivity
How do I navigate undo branches to recover changes that were overwritten by a new edit?
Vim doesn't have a simple linear undo stack — it maintains a full undo tree with branches.
category:
editing
tags:
#editing
#undo-redo
#normal-mode
#advanced
#productivity
How do I change the same column of text across multiple lines at once?
<C-v>jjc replacement<Esc>
Visual block mode's change command lets you replace a rectangular column of text across multiple lines in a single operation.
category:
visual-mode
tags:
#editing
#visual-mode
#block-mode
#normal-mode
#productivity
How do I expand or shrink a visual selection to the next text object boundary?
v + repeated iw/aw/i(/a(/ip/ap
Once you enter visual mode, you can progressively expand your selection by typing increasingly larger text objects.
category:
visual-mode
tags:
#visual-mode
#text-objects
#editing
#selection
#productivity
How do I select the text I just pasted or changed?
The ` [v] sequence visually selects the exact region of text that was last changed, pasted, or yanked into the buffer.
category:
visual-mode
tags:
#editing
#visual-mode
#marks
#paste
#productivity
How do I execute a single normal mode command without leaving insert mode?
Pressing in insert mode lets you execute one normal mode command and then automatically returns you to insert mode.
category:
editing
tags:
#editing
#insert-mode
#normal-mode
#productivity
How do I see spelling correction suggestions for a misspelled word?
When spell checking is enabled, the z= command opens a numbered list of spelling suggestions for the misspelled word under the cursor.
category:
editing
tags:
#editing
#spell-check
#normal-mode
#productivity
#prose
How do I create a macro that runs itself repeatedly until it fails?
A recursive macro calls itself at the end of its recording, creating a loop that repeats until a motion or command fails (like reaching the end of the file or f
category:
macros
tags:
#macros
#editing
#normal-mode
#automation
#advanced
How do I repeat the last f, t, F, or T character search on a line?
After using f, t, F, or T to jump to a character on the current line, pressing ; repeats the same search in the same direction, and , repeats it in the opposite
category:
navigation
tags:
#navigation
#motions
#normal-mode
#editing
#productivity
How do I overwrite existing text character by character without deleting first?
Replace mode lets you type over existing text one character at a time, like the "Insert" key behavior in traditional editors.
category:
editing
tags:
#editing
#normal-mode
#insert-mode
#replace