Visual Mode


Vim's visual modes are used to "visually select" content within a buffer. Vim has three different variations of visual mode, where each option interprets the selection region slightly differently from the others.

The first mode is simply called visual mode. Consider the following buffer:

Initial Conditions
I·have·always·believed,·and·I·still·believe,
that·whatever·good·or·bad·fortune·may·come·our·way
we·can·always·give·it·meaning·and
transform·it·into·something·of·value.
NORMAL40%2:5
 

Enter visual mode by pressing v:

Enter Visual Modev
I·have·always·believed,·and·I·still·believe,
that·whatever·good·or·bad·fortune·may·come·our·way
we·can·always·give·it·meaning·and
transform·it·into·something·of·value.
VISUAL40%2:5
 

Finally, move the cursor to another location in the buffer.

Define Current Selectionj3w
I·have·always·believed,·and·I·still·believe,
that·whatever·good·or·bad·fortune·may·come·our·way
we·can·always·give·it·meaning·and
transform·it·into·something·of·value.
VISUAL60%3:20
 

The key observations are:

  1. The selection starts from the upper-most cursor location (the cursor location when the editor entered visual mode), and includes all content to the right of the starting cursor location.

  2. The selection ends at the lower-most cursor location (the current cursor location), and includes all content to the left of the ending cursor location,

  3. All lines between the two cursor locations (if present) are included in the selection.