Course Lessons
Free Trial: 5 lessons remaining
Unlock Full Access
Quote Objects: Strings Made Easy
Estimated time: 10 minutes
Task Instructions
Master quote text objects for efficient string manipulation
Use quote text objects to manipulate strings. Position cursor anywhere inside quotes and use ci" to change contents, or ca" to change including the quotes themselves.
Learning objectives
- Master quote text objects: i", a", i', a', i`, a`
- Learn to change string contents efficiently
- Practice deleting and changing quoted text
- Understand when to use inside vs around
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 quotes
[cd][ia]["']
Use quote text 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 double quotes |
| ca" | Change around double quotes |
| ci' | Change inside single quotes |
| ci` | Change inside backticks |
| di" | Delete inside quotes |
Hints
- Works from anywhere inside the quotes
- Use 'i' to keep quotes, 'a' to include them
- Also works with backticks in many Vim configurations
# String Objects Practice
# Fix these string values using text objects
config = {
'hostname': 'princess-fluffybutt-server', # Change to 'localhost'
'username': 'sir-meows-a-lot', # Change to 'admin'
'password': 'whiskers123!', # Change to 'secure_pass'
'database': 'kitten_playground_db' # Change to 'main_db'
}
# JavaScript example with different quote types
const message = "Welcome to the cat cafe!"; // Change to 'Hello, World!'
const error = 'Sir Whiskers says: Error!'; // Change to just 'Error occurred'
const template = `Mr. Fluffy's temperature is ${temp}`; # Change to 'Temperature: ${temp}'
# TODO: Practice quote text objects
# 1. Use ci' to change content inside single quotes
# 2. Use ca" to change content including double quotes
# 3. Try di" to delete just the content
# 4. Try da' to delete including the quotes