How do I visually select multiple paragraphs or text objects at once using a count prefix?
v2ap
In Vim, text objects accept a count prefix in visual mode, letting you select multiple consecutive text objects in one keystroke.
v2ap
In Vim, text objects accept a count prefix in visual mode, letting you select multiple consecutive text objects in one keystroke.
:'<,'>w !{cmd}
The :'w !{cmd} command writes the visually selected lines to the stdin of an external shell command — without modifying the buffer.
gh
Vim's Select mode behaves like the familiar selection model in most GUI editors: after selecting text, any printable character you type replaces the selection a
:'<,'>w {filename}
After making a visual selection, you can write only those lines to a new file using :'w {filename}.
:'<,'>right {width}
The :right Ex command right-aligns lines within a given column width by padding them with spaces on the left.
visual-mode #visual-mode #formatting #ex-commands #alignment
:'<,'>sort!
The sort! command sorts the selected lines in reverse (descending) order.
{Visual}<C-a>
In Visual mode, pressing increments every number within the selection by 1 (or by a given [count]).
:'<,'>norm .
The :'norm .
visual-mode #visual-mode #editing #normal-mode #repeat #dot-operator
:'<,'>
Vim automatically sets two special marks whenever you make a visual selection: ' (end).
vipgq
The vipgq sequence reflowing a paragraph to fit within the width defined by textwidth (default 0, meaning no limit).
:'<,'>sort n
By default, :sort in Vim uses lexicographic (alphabetical) ordering, so "10" sorts before "2" because "1" sort n — sort selected lines by the leading number,
zp
Pastes a blockwise register like p, but skips padding lines shorter than the block's right edge with trailing spaces.
<C-v>{motion}I{text}<Esc>
Visual block mode () lets you select a rectangular region across multiple lines.
V%
Pressing V% enters visual line mode on the current line and immediately extends the selection to the line containing the matching bracket or brace.
{visual}p
When you visually select text and press p, Vim replaces the selection with the contents of the default register and saves the replaced text into the unnamed reg
O (in blockwise visual mode)
In blockwise Visual mode (), pressing O moves the cursor to the diagonally opposite corner of the rectangle.
C (visual-block)
In visual block mode, pressing C (uppercase) deletes from the leftmost column of the selection to the end of every selected line, then drops you into insert mod
<C-v>{motion}$A
In visual block mode, pressing $ makes the right edge of the selection "ragged" — it extends to the real end of each line regardless of length.
O (visual-block)
In Visual-Block mode (), pressing O moves the cursor to the diagonally opposite corner of the rectangular selection.
<C-v>{motion}~
Visual block mode () selects a rectangular column region, and pressing ~ at the end toggles the case of every character in that exact column range across all se