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.

16/19
Free Trial: 5 lessons remaining
Unlock Full Access

The Great Escape: How to Exit Vim

Estimated time: 10 minutes

Task Instructions

Learn the legendary :wq command - save your work and exit like a pro!

To complete this lesson, you need to save and exit Vim using :wq. Yes, this will end your browser Vim session - that's exactly what should happen! We keep everyone in Vim for safety, so exiting means you're done. Press Escape to ensure you're in Normal Mode, then type :wq and press Enter.

Learning objectives

  • Learn how to save and exit Vim with :wq
  • Understand why the session ends (it's a feature, not a bug!)
  • Gain confidence that breaking the session is the correct answer
  • Join the ranks of those who know how to save and exit Vim

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.

:wq
Save and exit Vim using :wq

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
:q Quit Vim (when no unsaved changes)
:q! Force quit without saving changes
:wq Save and quit
:x Save and quit (shorthand)
ZZ Save and quit (no colon needed)

Hints

  • Press Escape first to make sure you're in Normal Mode
  • Type :wq (colon then w then q) and press Enter
  • When the session ends, that means you did it right!
vim@sandbox: ~/workspace
Make sure to save your file with :w ⏎ before submitting!