@@ -2322,12 +2322,7 @@ pub mod cmd {
2322 write_all_impl(cx, args, event, true, true)
2322 write_all_impl(cx, args, event, true, true)
2325− fn quit_all_impl(
2325+ fn quit_all_impl(editor: &mut Editor, force: bool) -> anyhow::Result<()> {
2326− editor: &mut Editor,
2327− _args: &[Cow<str>],
2328− _event: PromptEvent,
2330− ) -> anyhow::Result<()> {
2331 if !force {
2326 if !force {
2332 buffers_remaining_impl(editor)?;
2327 buffers_remaining_impl(editor)?;
@@ -2343,18 +2338,18 @@ pub mod cmd {
2344 fn quit_all(
2339 fn quit_all(
2345 cx: &mut compositor::Context,
2340 cx: &mut compositor::Context,
2346− args: &[Cow<str>],
2341+ _args: &[Cow<str>],
2347− event: PromptEvent,
2342+ _event: PromptEvent,
2348 ) -> anyhow::Result<()> {
2343 ) -> anyhow::Result<()> {
2349− quit_all_impl(cx.editor, args, event, false)
2344+ quit_all_impl(cx.editor, false)
2352 fn force_quit_all(
2347 fn force_quit_all(
2353 cx: &mut compositor::Context,
2348 cx: &mut compositor::Context,
2354− args: &[Cow<str>],
2349+ _args: &[Cow<str>],
2355− event: PromptEvent,
2350+ _event: PromptEvent,
2356 ) -> anyhow::Result<()> {
2351 ) -> anyhow::Result<()> {
2357− quit_all_impl(cx.editor, args, event, true)
2352+ quit_all_impl(cx.editor, true)
2360 fn cquit(
2355 fn cquit(
@@ -2368,12 +2363,21 @@ pub mod cmd {
2368 .unwrap_or(1);
2363 .unwrap_or(1);
2369 cx.editor.exit_code = exit_code;
2364 cx.editor.exit_code = exit_code;
2371− let views: Vec<_> = cx.editor.tree.views().map(|(view, _)| view.id).collect();
2366+ quit_all_impl(cx.editor, false)
2372− for view_id in views {
2373− cx.editor.close(view_id);
2376− Ok(())
2369+ fn force_cquit(
2370+ cx: &mut compositor::Context,
2372+ _event: PromptEvent,
2373+ ) -> anyhow::Result<()> {
2374+ let exit_code = args
2376+ .and_then(|code| code.parse::<i32>().ok())
2378+ cx.editor.exit_code = exit_code;
2380+ quit_all_impl(cx.editor, true)
2379 fn theme(
2383 fn theme(
@@ -2877,6 +2881,13 @@ pub mod cmd {
2877 fun: cquit,
2881 fun: cquit,
2878 completer: None,
2882 completer: None,
2887+ doc: "Quit with exit code (default 1) forcefully (ignoring unsaved changes). Accepts an optional integer exit code (:cq! 2).",
2880 TypableCommand {
2891 TypableCommand {
2881 name: "theme",
2892 name: "theme",
2882 aliases: &[],
2893 aliases: &[],