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.

Free Trial: 5 lessons remaining
Unlock Full Access
Practice Beginner 10 min

The Great Escape: How to Exit Vim

Basic Text Editing

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

Your submission is checked for these keystrokes, not just the final text — so reach for the technique, not a workaround.

  • :wq Save and exit Vim using :wq

Helpful commands

: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)
Stuck? Peek at a hint 3 hints · try it on your own first
  • 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
Save your file with :w ⏎ to unlock Submit