Course
Free Trial: 5 lessons remaining
Unlock Full Access
Practice
Beginner
10 min
Text Objects with All Operators
Text Objects: Speaking Vim's Language
Task Instructions
Combine text objects with different operators for maximum power
Practice combining text objects with various operators. Use not just 'd' and 'c', but also 'y' for yanking, 'v' for visual selection, 'gU' for uppercase, 'gu' for lowercase.
Learning objectives
- Combine text objects with multiple operators
- Practice d, c, y, v with text objects
- Learn case changes with gU and gu
- Master the text object mindset
Required keystrokes
Your submission is checked for these keystrokes, not just the final text — so reach for the technique, not a workaround.
- g[Uu] Use case change operators
- [cdvy]i Combine operators with text objects
Helpful commands
- gUiw
- Uppercase inner word
- gui'
- Lowercase inside quotes
- dap
- Delete around paragraph
- yi(
- Yank inside parentheses
- vi{
- Select inside braces
- =ip
- Auto-indent paragraph
Stuck? Peek at a hint 3 hints · try it on your own first
- Text objects work with ANY operator
- gU = uppercase, gu = lowercase
- = operator auto-indents text objects
# Combining Text Objects with Operators
# Practice using text objects with different operators
def PROCESS_DATA(input_string):
# Make function name lowercase: guiw on PROCESS_DATA
result = calculate_value('make_this_uppercase') # gUi'
# Delete this entire comment block with dap
# This is unnecessary
# Remove all of this
items = ['keep', 'delete_me', 'keep'] # Use di' on middle item
config = {
'HOST': 'localhost', # Make lowercase: gui'
'port': 8080
}
# Select and examine this block with vip
# Then maybe delete it with dip
# Or change it with cip
return transform(result)
# TODO: Practice different operators with text objects
# 1. Use guiW to lowercase PROCESS_DATA
# 2. Use gUi' to uppercase string contents
# 3. Use dap to delete paragraph blocks
# 4. Use yi( to yank function arguments
# 5. Use vi{ to select dictionary contents