vimtricks.wiki Concise Vim tricks, one at a time.

How do I select text character by character in Vim?

Answer

v

Explanation

The v command enters character-wise visual mode, letting you select text one character at a time. This is the most basic form of visual selection.

How it works

  • Press v to start selection at the cursor
  • Move with any motion to extend the selection
  • The selection is highlighted as you move
  • Perform an action on the selection (d, y, c, etc.)

Example

hello world

Press v on h, then e to select hello. Press d to delete it.

Tips

  • V enters line-wise visual mode
  • <C-v> enters block-wise visual mode
  • gv reselects the last visual selection
  • o swaps to the other end of the selection
  • <Esc> cancels the selection

Next

How do you yank a single word into a named register?