Course Lessons
Free Trial: 5 lessons remaining
Unlock Full Access
Brackets, Braces & Parentheses
Estimated time: 10 minutes
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
This lesson requires you to use specific keystrokes to complete it. Your submission will be evaluated based on whether you used the required keystrokes mentioned below, rather than matching a specific output.
ci[\(\[\{]
Change inside delimiters
[cd][ia][\(\[\{]
Use delimiter objects
What This Means
- Your solution must include the required keystroke patterns
- The order of keystrokes may matter depending on the exercise
- You'll still need to achieve the expected output
- This helps you practice specific Vim techniques
Helpful commands:
| Command | Description |
|---|---|
| ci( | Change inside parentheses |
| ci[ | Change inside brackets |
| ci{ | Change inside braces |
| ca( | Change around parentheses |
| di{ | Delete inside braces |
Hints
- 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