selection
v / V / Ctrl-V
v enters character-wise visual mode, V enters line-wise visual mode, and Ctrl-V enters visual BLOCK (column/rectangle) mode. Once selected, operators like d, y, c, or > act on the whole region.
v V <C-v> (normal mode → visual) Variations
| Keystroke | Effect |
|---|---|
| gv | Re-select the last visual selection |
| o | While in visual mode, jump to the OTHER end of the selection |
| <C-v> then I{text}<Esc> | Block-insert: prepend {text} to every selected line |
| V then : | Run an ex command scoped to the visual range (shows :'<,'>) |
Examples
vw Character-select from cursor to next word start
Vjjd Line-select 3 lines and delete them
<C-v>3jI# <Esc> Block-select 4 lines and prepend '# ' to each (comment lines)
Gotcha
On Windows, Ctrl-V is often the paste shortcut and Vim may capture it — use
Related
yy
'Yank' (copy) the current line into the unnamed register — Vim's word for copy. Combine with p/P to duplicate lines without touching your system clipboard.
dd
Deletes the current line (and stores it in the unnamed register, so you can paste it back with p). The bread-and-butter 'get rid of this line' command.
Escape
Leaves the current mode and returns to normal mode. Vim is modal — most of the time you want to be in normal mode; if you're not sure what mode you're in, mash Escape.