@@ -2042,6 +2042,25 @@ mod cmd {
20422042 quit_all_impl(&mut cx.editor, args, event, true)
20432043 }
20442044
2045+ fn cquit(
2046+ cx: &mut compositor::Context,
2047+ args: &[&str],
2048+ _event: PromptEvent,
2049+ ) -> anyhow::Result<()> {
2050+ let exit_code = args
2051+ .first()
2052+ .and_then(|code| code.parse::<i32>().ok())
2053+ .unwrap_or(1);
2054+ cx.editor.exit_code = exit_code;
2055+
2056+ let views: Vec<_> = cx.editor.tree.views().map(|(view, _)| view.id).collect();
2057+ for view_id in views {
2058+ cx.editor.close(view_id, false);
2059+ }
2060+
2061+ Ok(())
2062+ }
2063+
20452064 fn theme(
20462065 cx: &mut compositor::Context,
20472066 args: &[&str],
@@ -2411,6 +2430,13 @@ mod cmd {
24112430 fun: force_quit_all,
24122431 completer: None,
24132432 },
2433+ TypableCommand {
2434+ name: "cquit",
2435+ aliases: &["cq"],
2436+ doc: "Quit with exit code (default 1). Accepts an optional integer exit code (:cq 2).",
2437+ fun: cquit,
2438+ completer: None,
2439+ },
24142440 TypableCommand {
24152441 name: "theme",
24162442 aliases: &[],