Implement the wa! command (#7577)
This commit is contained in:
parent
1698992de6
commit
828c7432e3
2 changed files with 20 additions and 0 deletions
|
@ -24,6 +24,7 @@
|
||||||
| `:write-quit`, `:wq`, `:x` | Write changes to disk and close the current view. Accepts an optional path (:wq some/path.txt) |
|
| `:write-quit`, `:wq`, `:x` | Write changes to disk and close the current view. Accepts an optional path (:wq some/path.txt) |
|
||||||
| `:write-quit!`, `:wq!`, `:x!` | Write changes to disk and close the current view forcefully. Accepts an optional path (:wq! some/path.txt) |
|
| `:write-quit!`, `:wq!`, `:x!` | Write changes to disk and close the current view forcefully. Accepts an optional path (:wq! some/path.txt) |
|
||||||
| `:write-all`, `:wa` | Write changes from all buffers to disk. |
|
| `:write-all`, `:wa` | Write changes from all buffers to disk. |
|
||||||
|
| `:write-all!`, `:wa!` | Forcefully write changes from all buffers to disk creating necessary subdirectories. |
|
||||||
| `:write-quit-all`, `:wqa`, `:xa` | Write changes from all buffers to disk and close all views. |
|
| `:write-quit-all`, `:wqa`, `:xa` | Write changes from all buffers to disk and close all views. |
|
||||||
| `:write-quit-all!`, `:wqa!`, `:xa!` | Write changes from all buffers to disk and close all views forcefully (ignoring unsaved changes). |
|
| `:write-quit-all!`, `:wqa!`, `:xa!` | Write changes from all buffers to disk and close all views forcefully (ignoring unsaved changes). |
|
||||||
| `:quit-all`, `:qa` | Close all views. |
|
| `:quit-all`, `:qa` | Close all views. |
|
||||||
|
|
|
@ -739,6 +739,18 @@ fn write_all(
|
||||||
write_all_impl(cx, false, true)
|
write_all_impl(cx, false, true)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn force_write_all(
|
||||||
|
cx: &mut compositor::Context,
|
||||||
|
_args: &[Cow<str>],
|
||||||
|
event: PromptEvent,
|
||||||
|
) -> anyhow::Result<()> {
|
||||||
|
if event != PromptEvent::Validate {
|
||||||
|
return Ok(());
|
||||||
|
}
|
||||||
|
|
||||||
|
write_all_impl(cx, true, true)
|
||||||
|
}
|
||||||
|
|
||||||
fn write_all_quit(
|
fn write_all_quit(
|
||||||
cx: &mut compositor::Context,
|
cx: &mut compositor::Context,
|
||||||
_args: &[Cow<str>],
|
_args: &[Cow<str>],
|
||||||
|
@ -2444,6 +2456,13 @@ pub const TYPABLE_COMMAND_LIST: &[TypableCommand] = &[
|
||||||
fun: write_all,
|
fun: write_all,
|
||||||
signature: CommandSignature::none(),
|
signature: CommandSignature::none(),
|
||||||
},
|
},
|
||||||
|
TypableCommand {
|
||||||
|
name: "write-all!",
|
||||||
|
aliases: &["wa!"],
|
||||||
|
doc: "Forcefully write changes from all buffers to disk creating necessary subdirectories.",
|
||||||
|
fun: force_write_all,
|
||||||
|
signature: CommandSignature::none(),
|
||||||
|
},
|
||||||
TypableCommand {
|
TypableCommand {
|
||||||
name: "write-quit-all",
|
name: "write-quit-all",
|
||||||
aliases: &["wqa", "xa"],
|
aliases: &["wqa", "xa"],
|
||||||
|
|
Loading…
Add table
Reference in a new issue