Mission 30 / 52• Text Objects - Bracket Pairs

Change Inside Brackets

`ci{` is among the most frequently used commands by professional programmers.

It wipes out the contents inside `{}` and drops you into insert mode, ready to type the replacement immediately.

Change inside brackets

  • ci{change inside curly braces and enter insert mode
  • ci(change inside parentheses (arguments) and enter insert mode
  • ci[change inside square brackets and enter insert mode
1
function greet() {
2
console.log("old greeting");
3
}

Move anywhere inside `greet()`, type `ci{`, and type `return "Hello World";`. Done in 3 keys!

Now it's your turn!

0 / 4 tasks complete0.0s / 26s par0 / 45 par

Practice this lesson's commands. Each task checks your technique and the result, not just your cursor position. Take your time.

Task 1: Replace the array contents with 1, 2 using ci[. Return to normal mode.

Expected result
const ids = [1, 2];
Show hint

Use ci[, type 1, 2, then Escape.

1
const ids = [10, 20];
jkscroll•ggGtop/bottom•Tabnext example•Enterstart•qstop•Ctrl+kCtrl+jprev/next