How do you format (rewrap) a visual selection to textwidth?
gq in visual mode
Select text with v or V, then press gq to format the selection according to textwidth.
261 results for "visual mode"
gq in visual mode
Select text with v or V, then press gq to format the selection according to textwidth.
<C-v>jjr*
Enter visual block with , select a column with j, press r followed by the replacement character.
o (in Visual mode)
When you make a Visual selection in Vim, the cursor sits at one end while the other end is anchored.
c in visual mode
Select text visually, then press c to delete the selection and enter insert mode.
>
In visual mode, pressing > indents all selected lines by one shiftwidth.
:'<,'>s/pattern/replacement/g
When you make a visual selection and then type :, Vim automatically inserts ' as the range — the marks for the start and end of the last visual selection.
>gv
Normally, pressing > in visual mode indents the selection but exits visual mode, requiring you to press gv to reselect.
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.
visual-mode #visual-mode #text-objects #editing #selection #productivity
<C-v>jj<C-a>
Select numbers with visual block mode , then press to increment all selected numbers by 1.
p (in visual mode)
In visual mode, pressing p replaces the selected text with the contents of the default register.
<C-v>jjA text <Esc>
Enter visual block with , select lines with j, press A to append after the block.
<C-v>jjI text <Esc>
Enter visual block with , select lines with j, press I to insert before the block.
o (visual mode)
In visual mode, pressing o swaps the cursor between the two ends of the selection (the anchor and the free end).
v{motion}<C-g>
Vim has a lesser-known select mode that behaves like selection in typical GUI editors: any typed character replaces the selection.
:'<,'>move'>+1 or :'<,'>move'<-2
How it works Vim's :move command lets you relocate lines to a different position.
zf (in visual mode)
In visual mode, pressing zf creates a manual fold from the selected lines.
:'<,'>s/old/new/g
After making a visual selection, you can run a substitute command that only affects the selected text.
:'<,'>s/\%Vpattern/replacement/g
When you press : after making a visual selection, Vim inserts ' to restrict the substitution to the selected lines.
visual-mode #visual-mode #search #editing #ex-commands #normal-mode
v/pattern<CR>
Starting a search while in visual mode extends the selection to the search match.
P (in visual mode)
When you paste over a visual selection using p (lowercase), Vim replaces the selection with your register contents — but the replaced text overwrites your unn