Course Lessons
Free Trial: 5 lessons remaining
Unlock Full Access
Visual Mode Operation Combinations
Estimated time: 10 minutes
Task Instructions
Combine different visual modes and operations to tackle complex formatting challenges
Practice combining different visual modes (v, V, Ctrl+v) with various operations (d, c, y, >, <) to solve complex formatting challenges efficiently.
Learning objectives
- Combine different visual modes and operations
- Tackle complex formatting challenges
- Master applying operations to visual selections
- Learn to choose the right visual mode for each task
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.
V
Use visual line mode
<
Shift lines left
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 |
|---|---|
| V | Visual line mode |
| < | Shift left (decrease indentation) |
| > | Shift right (increase indentation) |
| gv | Re-select last visual selection |
| = | Auto-indent selected lines |
Hints
- Use V to select lines, then < to shift left
- You can press < multiple times or use a count like 2<
- Combine different visual modes for different types of selections
# Mixed Formatting Challenge
# This code has different naming conventions and formatting issues
# Monday - Snake case with cat names
user_mr_whiskers_data = get_user_info()
order_princess_fluffybutt_total = calculate_total()
# Tuesday - CamelCase with cat titles
SirMeowsALotValidator = create_validator()
LadyMittensProcessor = initialize_processor()
# Wednesday - ALL CAPS CAT NAMES (he was excited)
MR_WHISKERS_CONNECTION_STRING = "database://localhost"
PRINCESS_FLUFFYBUTT_API_ENDPOINT = "https://api.cats.com"
# Thursday - Random indentation (needs fixing)
randomly_indented_variable = 'value'
another_weird_indent = 'another_value'
why_is_this_so_far = 'fix_this'
# TASK: Fix the indentation in the Thursday section using visual line mode
# Select all 3 Thursday lines and shift them left to proper alignment