@@ -2042,6 +2042,25 @@ mod cmd {
2042 quit_all_impl(&mut cx.editor, args, event, true)
2042 quit_all_impl(&mut cx.editor, args, event, true)
2046+ cx: &mut compositor::Context,
2048+ _event: PromptEvent,
2049+ ) -> anyhow::Result<()> {
2050+ let exit_code = args
2052+ .and_then(|code| code.parse::<i32>().ok())
2054+ cx.editor.exit_code = exit_code;
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);
2045 fn theme(
2064 fn theme(
2046 cx: &mut compositor::Context,
2065 cx: &mut compositor::Context,
2047 args: &[&str],
2066 args: &[&str],
@@ -2411,6 +2430,13 @@ mod cmd {
2411 fun: force_quit_all,
2430 fun: force_quit_all,
2412 completer: None,
2431 completer: None,
2436+ doc: "Quit with exit code (default 1). Accepts an optional integer exit code (:cq 2).",
2414 TypableCommand {
2440 TypableCommand {
2415 name: "theme",
2441 name: "theme",
2416 aliases: &[],
2442 aliases: &[],