Skip to main content

V Mode

This mode can be entered by pressing v, it is a short-lived mode where the next keypress leads to one of the following:

  1. Surround-related actions (entered by pressing either a/i/d/c/s)
  2. Extending selection (entered by pressing any other keys)

This is a group of actions that is related to "surround" or "enclosures".

KeybindingAction
a<x>Select around <x>
i<x>Select inside <x>
d<x>Delete surrounding <x>
c<x><y>Change surrounding <x> to <y>
s<x>Surround current selection with <x>

<x> can be one of the following:

  • ( Parenthesis
  • { Curly Brace
  • [ Square Bracket
  • < Angular Bracket
  • ' Single Quote
  • " Double Quote
  • ` Backtick

Extending selection

This is used for extending the current selection.

For example, selecting multiple words or multiple lines.

It behaves more or less the same as click-and-drag in the textbox or text area of common GUI applications, but imagine being able to tune both ends, unlike using a mouse where an incorrect selection means you have to start over again.

When selection extension is enabled:

  1. Each selection is composed of two ranges (originally one range).
  2. There's only one moveable range at a time.
  3. Press v again to change the moveable range to the other range.
  4. Every character between the two ranges, including the two ranges, is selected
  5. Selection-wise actions work on the extended range
  6. Press ESC to disable selection extension