Match nested delimiters
The technique
% lands on the last bracket, which is the real partner. It skips the first closing bracket it meets.
Keys in this lesson
- %
- The matching bracket.
- d%
- Delete to the matching bracket, brackets included.
Before this lesson: Choose the whole pair.
More about this lesson
Jump to a bracket's real partner instead of the next bracket that looks the same.
On a bracket, % moves to its partner, even through nested pairs. Anywhere else on the line, it uses the next bracket after the cursor. d% deletes from the cursor to that partner, brackets and all. A character search like f) just finds the next ), so it can stop at the wrong one.
Example
On the first opening bracket in outer(inner(value)), % jumps to the very last closing bracket and skips the inner one.
Use Start over to try again.
Guides on this topic
Exercise 1 of 2
0keys
par 8The search fires on every key. Wait 300 milliseconds: add it as the second argument of setTimeout.
Make it look like this
import { searchProducts } from "../api/search"; // Searches as the customer types, but waits until they pause. export function onQueryChange(input, render) { clearTimeout(input.timer); input.timer = setTimeout(() => { searchProducts(input.value).then(render); }, 300); }