Mission 27 / 52• Text Objects - Bracket Pairs

Intro to Text Objects

Text objects are Vim's superpower. Instead of moving character-by-character or selecting with a mouse, you command Vim to edit semantic code structures.

The formula is `[operator] + [i or a] + [object]`. `i` means *inside* (content only), while `a` means *around* (content plus surrounding delimiters).

Text object structure

  • i{obj}inside text object (excludes enclosing delimiters)
  • a{obj}around text object (includes enclosing delimiters)
1
const user = { name: "John", age: 30 };
2
function run() { return true; }

With text objects, your cursor just needs to be *somewhere inside* the brackets. You don't have to navigate to the boundary!

Now it's your turn!

  1. Navigate to each green target across the code snippet.
  2. Use the motions and techniques learned in this lesson to land accurately on each target.
  3. See how fast you can complete 10 targets.
0/10
1
const user = { name: "John", age: 30 };
2
function run() { return true; }
NORMAL
00:00