How do I quickly select an entire function body using visual mode?
The a{ (around braces) and i{ (inside braces) text objects combined with visual mode let you instantly select an entire function body or code block, regardless
category:
visual-mode
tags:
#visual-mode
#text-objects
#code-navigation
#selection
How do I replace every character in a visual selection with a single character?
In visual mode, pressing r followed by a character replaces every character in the selection with that single character.
category:
visual-mode
tags:
#visual-mode
#editing
#replace
#selection
How do I move the cursor to the other end of a visual selection?
While in visual mode, pressing o swaps the cursor to the opposite end of the selection.
category:
visual-mode
tags:
#visual-mode
#selection
#cursor
#navigation
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 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 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 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