Step 2 of 6

The structure of match mode

The structure of match mode

Match mode is a small grammar of its own. Every selection it makes has the same shape:

m {i or a} {pair}

That means, from normal mode:

  • we press m to enter match mode
  • we then say whether we want the inner content (i) or the content around it (a), including the pair itself
  • we then name the pair: (, [, {, <, ", ' or a backtick

Inner and around are the same distinction other editors make you draw with the mouse. Generally speaking, inner captures the content within the given construct, whereas around captures the content and the surrounding delimiters.

Which one you want depends on what you’re trying to achieve. If you want to replace the text of a string, you want the inside (mi"), and you’ll follow it with c. If you want the string gone entirely, quotes and all, you want around (ma"), followed by d.

There’s a quoted string in the editor. Work through the checklist below to see the difference for yourself. Notice that you don’t need to undo the first selection before making the second — a new match-mode selection simply replaces the old one.

  1. Select inside the quotes Place your cursor within the quoted string on the last line, then type mi".
  2. Select around the quotes Stay within the quotes and type ma" — the selection grows to include the " characters.
Select inside the quotes Place your cursor within the quoted string on the last line, then type mi".

Next: Select around the quotes

Loading editor…