Vim Recall繁體中文

Quit Vim with an error code

:cquit

Example

Normal 0 / 2
unsaved change
Cursor on line 1, column 1

Quit Vim with an error code.

Editing session

modified
yes
Saved file
original
Before & after
Before
unsaved change
Cursor on line 1, column 1

Editing session

modified
yes
Saved file
original
After

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.