Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Surround

Add, replace, or remove matching delimiters around selected text, such as parentheses, brackets, and quotes.

Surround demo

Key SequenceAction
ms<char> (after selecting text)Add surround characters to selection
mr<char_to_replace><new_char>Replace the closest surround characters
md<char_to_delete>Delete the closest surround characters

You can use counts to act on outer pairs.

Surround can also act on multiple selections. For example, to change every occurrence of (use) to [use]:

  1. % to select the whole file
  2. s to select matches of a search term
  3. Input use and hit Enter
  4. mr([ to replace the parentheses with square brackets

Surround operations accept single delimiter characters.