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)
1const user = { name: "John", age: 30 };2function 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!
- Navigate to each green target across the code snippet.
- Use the motions and techniques learned in this lesson to land accurately on each target.
- See how fast you can complete 10 targets.
0/10
1const user = { name: "John", age: 30 };2function run() { return true; }NORMAL
00:00
NextCtrl+jDelete Inside Brackets