@@ -1086,6 +1086,36 @@ mod cmd {
1086 _write_all(editor, args, event, true, true)
1086 _write_all(editor, args, event, true, true)
1089+ fn _quit_all(editor: &mut Editor, args: &[&str], event: PromptEvent, force: bool) {
1091+ // check if there are some unsaved buffers
1092+ let modified = _modified_left(editor);
1093+ if !modified.is_empty() {
1095+ "{} unsaved buffer(s) remaining: {:?}",
1099+ editor.set_error(err);
1105+ let views: Vec<_> = editor.tree.views().map(|(view, _)| view.id).collect();
1106+ for view_id in views {
1107+ editor.close(view_id, false);
1111+ fn quit_all(editor: &mut Editor, args: &[&str], event: PromptEvent) {
1112+ _quit_all(editor, args, event, false)
1115+ fn force_quit_all(editor: &mut Editor, args: &[&str], event: PromptEvent) {
1116+ _quit_all(editor, args, event, true)
1089 pub const COMMAND_LIST: &[Command] = &[
1119 pub const COMMAND_LIST: &[Command] = &[
1090 Command {
1120 Command {
1091 name: "quit",
1121 name: "quit",
@@ -1165,19 +1195,34 @@ mod cmd {
1165 completer: None,
1195 completer: None,
1167 Command {
1197 Command {
1168− name: "write-all-quit",
1198+ name: "write-quit-all",
1169− alias: Some("waq"),
1199+ alias: Some("wqa"),
1170 doc: "Writes changes from all views to disk and close all views.",
1200 doc: "Writes changes from all views to disk and close all views.",
1171 fun: write_all_quit,
1201 fun: write_all_quit,
1172 completer: None,
1202 completer: None,
1174 Command {
1204 Command {
1175− name: "write-all-quit!",
1205+ name: "write-quit-all!",
1176− alias: Some("waq!"),
1206+ alias: Some("wqa!"),
1177− doc: "Writes changes from all views to disk and close all views forcefully (ignoring errors).",
1207+ doc: "Writes changes from all views to disk and close all views forcefully (ignoring unsaved changes).",
1178 fun: force_write_all_quit,
1208 fun: force_write_all_quit,
1179 completer: None,
1209 completer: None,
1214+ doc: "Close all views.",
1220+ alias: Some("qa!"),
1221+ doc: "Close all views forcefully (ignoring unsaved changes).",
1222+ fun: force_quit_all,
1183 pub static COMMANDS: Lazy<HashMap<&'static str, &'static Command>> = Lazy::new(|| {
1228 pub static COMMANDS: Lazy<HashMap<&'static str, &'static Command>> = Lazy::new(|| {