How do you quit Vim without saving?

Vim · File Operations · updated 2026-08-23

:q! — Force Quit

Press Esc to leave insert mode, type :q! and press Enter. The exclamation mark discards unsaved changes; :wq saves and quits, and :q alone refuses to quit while the buffer is modified.

Related Vim shortcuts: File Operations

ShortcutActionNotes
:wSaveSave file
:qQuitQuit Vim
:wqSave & QuitSave and quit
:q!Force QuitQuit without saving
:e filenameEdit FileOpen file for editing
:spSplit HorizontalSplit window horizontally
:vspSplit VerticalSplit window vertically

From the Vim reference (57 entries) · all how-to answers