Course
Free Trial: 5 lessons remaining
Unlock Full Access
Practice
Beginner
10 min
Brackets, Braces & Parentheses
Text Objects: Speaking Vim's Language
Task Instructions
Master delimiter text objects for code manipulation
Use delimiter text objects to edit code structures. Position cursor inside parentheses and use ci( to change contents, or use ci{ for braces, ci[ for brackets.
Learning objectives
- Master delimiter text objects: i(, a(, i[, a[, i{, a{
- Learn to edit function arguments and array elements
- Practice changing code blocks and data structures
- Understand nested delimiter handling
Required keystrokes
Your submission is checked for these keystrokes, not just the final text — so reach for the technique, not a workaround.
- ci[\(\[\{] Change inside delimiters
- [cd][ia][\(\[\{] Use delimiter objects
Helpful commands
- ci(
- Change inside parentheses
- ci[
- Change inside brackets
- ci{
- Change inside braces
- ca(
- Change around parentheses
- di{
- Delete inside braces
Stuck? Peek at a hint 3 hints · try it on your own first
- Works with (), [], {}, and even <> for HTML tags
- Vim is smart about nested delimiters
- Use 'a' variants to include the delimiters
# Delimiter Objects Practice
# Fix function calls and data structures
def process_data(old_arg1, old_arg2, old_arg3): # Change args to: data, options, callback
# Fix this array
ids = [111, 222, 333, 444] # Change to: 1, 2, 3, 4
# Fix this dictionary
settings = {
'timeout': 999999, # Change contents to: 'timeout': 5000, 'retries': 3
'debug': False
}
# Fix nested structures
result = calculate(multiply(10, 20), add(30, 40)) # Change multiply args to 2, 3
# Fix this condition
if (user.age > 100 and user.name == 'Methuselah'): # Change to: user.age >= 18
return True
# HTML/JSX example
html = '<div class="old-class">Old Content</div>' # Change to: class="new-class", content: New Text
# TODO: Use delimiter text objects
# 1. Use ci( to change function arguments
# 2. Use ci[ to change array contents
# 3. Use ci{ to change object/dict contents
# 4. Try ca( to replace entire parentheses groups