Visual Mode
Vim Text Editor Quick Reference
2 min read
Published Jul 6 2025
Guide Sections
Guide Comments
Visual mode allows you to select and highlight blocks of text, and then do operations like delete etc. on whatever is selected.
Enter visual mode
Key | Description |
---|---|
v | Enters visual mode on the current character, you can then move the cursor to start selecting text |
V | Enters visual mode in line mode by highlighting the current line, you can then move up and down to select more lines |
Ctrl+V | Enter visual mode in block mode, good for selecting columns in the text |
Making selections in visual mode
Key | Description |
---|---|
horjorkorl | Increase the selection with the cursor keys |
ororor | Increase the selection with the cursor keys alternative |
w | Increase the selection to the next word |
b | Decrease the selection to the previous word |
} | Increase the selection to the end of the paragraph |
{ | Decrease the selection to the previous paragraph |
% | Change the selection to match the contents of the highlighted bracket, either [ ( { } ) ] |
Making changes to highlighted selection in visual mode
All the standard delete, yank, cut, increment numbers, change case etc. can be applied to the highlighted section. For example you can delete all the highlighted selection by pressing d
, or increment all numbers in a column that have been highlighted in block mode by pressing Ctrl+A
. Refer to the normal mode section of this guide for a list of options you can use.
Exiting visual mode
Key | Description |
---|---|
EscEsc | Pressing escape key twice will exit visual mode and return to normal mode |
Some examples of using all 3 visual modes
First create a file, or copy and paste in, this example text in to Vim:
Step 1: Character-wise Visual Mode
- Move your cursor to the start of the word banana.
- Press
v
to enter character-wise visual mode. - Move with
l
(right arrow) until the whole wordbanana
is selected. - Press
y
to yank (copy) it. - Move to the bottom line (
grape
) and pressp
to paste it.
You should see:
Step 2: Line-wise Visual Mode
- Press
V
while on the wordcherry
. - Press
j
twice to select down toelderberry
. - Press
d
to delete those lines.
You should see:
Step 3: Block-wise (Column) Visual Mode
Let’s prepend an *
to each fruit:
- Press
gg
to go to the top of the file. - Press
Ctrl-v
to enter block-wise mode. - Press
j
three times to select the first column of the first 4 lines. - Press
Shift+I
then type*
, then pressEsc
.
You should see a *
at the start of every line:
Step 4: Uppercase all fruits
- Press
gg
to go to the top. - Press
Shift+V
thenShift+G
to visually select from top to bottom. - Press
g Shift+U
to make all text uppercase.
You should see: