How do I collect all lines matching a pattern and copy them to the end of the file or a register?
The :g command combined with yank A (uppercase A to append) lets you collect every line matching a pattern into a single register without overwriting previous c
category:
command-line
tags:
#editing
#ex-commands
#global-command
#registers
#filtering
How do I append text to the end of multiple lines at once using visual block mode?
Visual block mode combined with $A lets you append text to the end of multiple lines simultaneously, even when those lines have different lengths.
category:
visual-mode
tags:
#editing
#visual-mode
#block-mode
#productivity
#insert-mode
How do I specify line ranges in Ex commands to target specific parts of a file?
Every Ex command in Vim can be preceded by a range that specifies which lines it should operate on.
category:
command-line
tags:
#command-line
#ex-commands
#ranges
#editing
#productivity
How do I set up auto-correct abbreviations in Vim to fix common typos?
Vim's abbreviation system automatically expands short text sequences as you type, making it perfect for auto-correcting typos, inserting boilerplate snippets, o
category:
config
tags:
#editing
#insert-mode
#config
#productivity
#auto-correct
How do I swap two characters in Vim?
The xp command swaps the character under the cursor with the character to its right.
category:
editing
tags:
#editing
#normal-mode
How do I toggle the case of a character in Vim?
The ~ command toggles the case of the character under the cursor — uppercase becomes lowercase and vice versa — then advances the cursor one position to the
category:
editing
tags:
#editing
#normal-mode
#formatting
How do I paste text from outside Vim without messing up indentation?
The :set paste command enables paste mode, which temporarily disables auto-indentation, smart tabs, and other insert-mode features that can mangle text pasted f
category:
config
tags:
#config
#editing
#insert-mode
How do I undo the last change in Vim?
The u command undoes the last change you made in normal mode.
category:
editing
tags:
#editing
#undo-redo
#normal-mode
How do I uppercase a word in Vim?
The gUiw command converts the entire word under the cursor to uppercase.
category:
editing
tags:
#editing
#text-objects
#normal-mode
#formatting
How do I insert the same text on multiple lines at once?
Visual block mode combined with I lets you insert the same text at the beginning of multiple lines simultaneously.
category:
visual-mode
tags:
#visual-mode
#editing
#insert-mode
How do I select a rectangular block of text in Vim?
The (Ctrl+v) command enters visual block mode, which lets you select a rectangular column of text across multiple lines.
category:
visual-mode
tags:
#visual-mode
#editing
#normal-mode
How do I save a file I opened without sudo permissions?
The :w !sudo tee % command lets you save a file that requires root permissions, even if you forgot to open Vim with sudo.
category:
command-line
tags:
#command-line
#ex-commands
#editing
How do I copy an entire line in Vim?
The yy command yanks (copies) the entire current line, including the newline character.
category:
editing
tags:
#editing
#registers
#yank
#normal-mode
How do I copy text to the system clipboard in Vim?
The "+y command yanks (copies) text into the system clipboard register, making it available to paste in other applications outside of Vim.
category:
registers
tags:
#registers
#yank
#editing
#normal-mode
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 select an entire line in visual mode?
The V (uppercase) command enters visual line mode, which selects the entire current line.
category:
visual-mode
tags:
#visual-mode
#editing
#normal-mode
How do I select the contents inside curly braces?
The vi{ command visually selects everything inside the nearest pair of curly braces {}, without selecting the braces themselves.
category:
visual-mode
tags:
#visual-mode
#text-objects
#editing
#normal-mode
How do I select an entire paragraph in Vim?
The vip command visually selects the inner paragraph — all contiguous non-blank lines surrounding the cursor.
category:
visual-mode
tags:
#visual-mode
#text-objects
#editing
#normal-mode
How do I show invisible characters like tabs and trailing spaces?
The :set list command makes invisible characters visible by displaying them as special symbols.
category:
config
tags:
#config
#ex-commands
#editing
How do I sort selected lines in Vim?
The :'sort command sorts the currently selected lines in visual mode alphabetically.
category:
visual-mode
tags:
#visual-mode
#ex-commands
#editing
#formatting