Quit Vim with an error code
Example
Normal 0 / 2Command-line 1 / 2Exited 2 / 2unsaved changeCursor on line 1, column 1unsaved changeCursor on line 1, column 1Vim is closed
Quit Vim with an error code.
Editing session
- modified
yes- Saved file
original
Command entered · ready to apply
Editing session
- modified
yes- Saved file
original
Command line
- Typed text
:cquit- Insertion offset
6
:cquit exits Vim with status 1 and discards unsaved changes.
Saved file
- Contents
original
Process result
- Exit code
1- Unsaved change
discarded
Before & after
unsaved changeCursor on line 1, column 1Editing session
- modified
yes- Saved file
original
Vim is closed
Saved file
- Contents
original
Process result
- Exit code
1- Unsaved change
discarded
Documentation-backed illustration. the illustrated session contains only disposable example buffers; :cquit uses its default error code. :cquit exits Vim with status 1 and discards unsaved changes. Primary help: :cquit.
Details & Vim help
Quit Vim with an error code. This Ex reference uses the full command name; the alphabetical index omits arguments. Supply the ranges, arguments, flags and prerequisite state documented in the linked help. Press Enter to submit a complete command. The index spelling :cq[uit] puts the optional abbreviation suffix in square brackets; those brackets are not typed. Availability and exact behavior can depend on Vim build features, options, mappings and editor state; the linked help is authoritative.