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 search for text only within a visual selection?
The \%V atom restricts a search pattern to only match inside the most recent visual selection.
category:
search
tags:
#search
#visual-mode
#regex
#substitution
#advanced
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 join multiple lines together with a custom separator like a comma?
Vim's J command joins lines with a single space, but sometimes you need a custom separator like a comma, pipe, or semicolon.
category:
editing
tags:
#editing
#ex-commands
#visual-mode
#substitution
#lines
How do I auto-indent a block of code using visual mode?
Pressing = in visual mode auto-indents the selected lines according to Vim's built-in indentation rules.
category:
visual-mode
tags:
#editing
#visual-mode
#indentation
#formatting
#productivity
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 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 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 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
How do I reselect the last visual selection?
The gv command reselects the exact same area that was last selected in visual mode.
category:
visual-mode
tags:
#visual-mode
#normal-mode
#editing
How do I run a macro on every line in a visual selection?
The :'normal @a command executes the macro stored in register a on every line within the current visual selection.
category:
macros
tags:
#macros
#visual-mode
#ex-commands
#editing
How do I create incrementing number sequences in Vim?
The g command increments numbers across a visual selection so that each subsequent line gets a progressively higher value.
category:
visual-mode
tags:
#visual-mode
#editing
#normal-mode
How do I select the text inside quotes?
The vi" command visually selects all text inside double quotes, without including the quotes themselves.
category:
visual-mode
tags:
#visual-mode
#text-objects
#editing
#normal-mode