Appendix

Notes on why quitting works the way it does.

Modes

Vim is modal. The same key can do different things depending on state.

Pressing Esc reliably returns you toward Normal mode, which is the baseline for issuing commands like :q.

Unsaved changes

If the current buffer differs from the file on disk, Vim prevents quitting with :q.

Use :w to save, :wq to save-and-quit, or :q! to quit without saving.

Macros

Macro recording is toggled with q.

Macro playback can be interrupted with Ctrl+C.

Minimal exit sequence

Esc :q Enter