Step 6 of 6

3. Basic Navigation

Jumping to matching characters

Certain characters come in opening and closing pairs. For example (), {}, and [].

Sometimes, you’ll want to jump from the opening character to the closing character, or vice-versa. Vim has a command for that: % in normal mode.

There’s some matching bracket pairs set up for you in the editor. Work through the checklist below to put % through its paces.

  1. Jump to the matching bracket The cursor starts on the opening ( — to land on its partner, press %.
  2. Jump back again To bounce back to the opening (, press % a second time.
  3. Match the curly braces Put the cursor on the { a few lines down, then press %.
  4. Untangle the mess Find the partner of the very first ( in the pile — 16G puts you on it, then press %.
Jump to the matching bracket The cursor starts on the opening ( — to land on its partner, press %.

Next: Jump back again

Loading editor…