Screen Too Small

This course material requires a larger screen to properly display the terminal and editor interfaces.

Please use a tablet, laptop, or desktop computer for the best learning experience.

You can continue browsing, but the experience will be significantly limited.

23/24

The Great Refactor

Estimated time: 10 minutes

Task Instructions

Apply all your Vim skills to refactor messy legacy code

This is a comprehensive challenge that requires you to use undo, visual mode, and text objects together to clean up legacy code. Take your time, experiment, and use undo when needed.

Learning objectives

  • Combine all learned techniques in realistic scenarios
  • Practice strategic use of undo during complex edits
  • Apply text objects and visual mode together
  • Develop professional Vim workflows

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.

[cd]i[w"'()]
Use text objects for editing
u
Use undo for safety

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
ciw Change inner word
ci( Change inside parentheses
V Visual line mode
u Undo mistakes
. Repeat last change

Hints

  • Use ciw to change class/method/variable names
  • Use u to undo if you make a mistake
  • Use . to repeat similar changes
  • Visual mode can help select complex names

Premium Course

This is a premium course available exclusively to paid members.

Upgrade your membership to access this course and all premium content on the platform.

Upgrade to Premium

Access all premium courses

Unlimited lesson submissions

Track your progress

Ready for Vim?

Before starting this lesson, be prepared.

Read the directions on the left, and when you're ready, let's go!