Visual Mode

Vim Text Editor Quick Reference

2 min read

Published Jul 6 2025


11
0
0
0

LinuxText Editor

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

KeyDescription
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

KeyDescription
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

KeyDescription
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:

apple
banana
cherry
date
elderberry
fig
grape

Step 1: Character-wise Visual Mode

  1. Move your cursor to the start of the word banana.
  2. Press v to enter character-wise visual mode.
  3. Move with l (right arrow) until the whole word banana is selected.
  4. Press y to yank (copy) it.
  5. Move to the bottom line (grape) and press p to paste it.

You should see:

apple
banana
cherry
date
elderberry
fig
grapebanana

Step 2: Line-wise Visual Mode

  1. Press V while on the word cherry.
  2. Press j twice to select down to elderberry.
  3. Press d to delete those lines.

You should see:

apple
banana
fig
grapebanana

Step 3: Block-wise (Column) Visual Mode

Let’s prepend an * to each fruit:

  1. Press gg to go to the top of the file.
  2. Press Ctrl-v to enter block-wise mode.
  3. Press j three times to select the first column of the first 4 lines.
  4. Press Shift+I then type *, then press Esc.

You should see a * at the start of every line:

*apple
*banana
*fig
*grapebanana

Step 4: Uppercase all fruits

  1. Press gg to go to the top.
  2. Press Shift+V then Shift+G to visually select from top to bottom.
  3. Press g Shift+U to make all text uppercase.

You should see:

*APPLE
*BANANA
*FIG
*GRAPEBANANA


Products from our shop

Vim Cheat Sheet - Print at Home Designs

Vim Cheat Sheet - Print at Home Designs

Vim Cheat Sheet Mouse Mat

Vim Cheat Sheet Mouse Mat

Vim Cheat Sheet Travel Mug

Vim Cheat Sheet Travel Mug

Vim Cheat Sheet Mug

Vim Cheat Sheet Mug

Docker Cheat Sheet - Print at Home Designs

Docker Cheat Sheet - Print at Home Designs

Docker Cheat Sheet Mouse Mat

Docker Cheat Sheet Mouse Mat

Docker Cheat Sheet Travel Mug

Docker Cheat Sheet Travel Mug

Docker Cheat Sheet Mug

Docker Cheat Sheet Mug

SimpleSteps.guide branded Travel Mug

SimpleSteps.guide branded Travel Mug

Developer Excuse Javascript - Travel Mug

Developer Excuse Javascript - Travel Mug

Developer Excuse Javascript Embroidered T-Shirt - Dark

Developer Excuse Javascript Embroidered T-Shirt - Dark

Developer Excuse Javascript Embroidered T-Shirt - Light

Developer Excuse Javascript Embroidered T-Shirt - Light

Developer Excuse Javascript Mug - White

Developer Excuse Javascript Mug - White

Developer Excuse Javascript Mug - Black

Developer Excuse Javascript Mug - Black

SimpleSteps.guide branded stainless steel water bottle

SimpleSteps.guide branded stainless steel water bottle

Developer Excuse Javascript Hoodie - Light

Developer Excuse Javascript Hoodie - Light

Developer Excuse Javascript Hoodie - Dark

Developer Excuse Javascript Hoodie - Dark

© 2025 SimpleSteps.guide
AboutFAQPoliciesContact