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

How do I jump to the next unmatched opening brace?

Answer

[{

Explanation

The [{ command moves backward to the nearest unmatched {. This is extremely useful for jumping to the beginning of the current code block in languages like C, Java, and JavaScript.

How it works

  • [{ searches backward, skipping matched {} pairs
  • Stops at the first { that does not have a matching }
  • Effectively finds the enclosing block start

Example

function process() {
    if (condition) {
        doSomething();
    }
}

With the cursor on doSomething, pressing [{ jumps to the { of the if block. Pressing [{ again jumps to the { of the function.

Tips

  • ]} jumps forward to the next unmatched }
  • Perfect for figuring out which block you are in
  • Works with d[{ to delete back to the block start
  • Pair with % for comprehensive bracket navigation

Next

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