diff options
author | Ryan Fowler | 2023-07-09 14:38:50 +0000 |
---|---|---|
committer | GitHub | 2023-07-09 14:38:50 +0000 |
commit | 828c7432e363c46cd9202cdb973a67f0421d2c0f (patch) | |
tree | 328283d9b4c71f3f086bb756dac8381c2949e6bb | |
parent | 1698992de6a601e65a0598ed132cab5419f7e578 (diff) |
Implement the wa! command (#7577)
-rw-r--r-- | book/src/generated/typable-cmd.md | 1 | ||||
-rw-r--r-- | helix-term/src/commands/typed.rs | 19 |
2 files changed, 20 insertions, 0 deletions
diff --git a/book/src/generated/typable-cmd.md b/book/src/generated/typable-cmd.md index a3949960..ce28a3ca 100644 --- a/book/src/generated/typable-cmd.md +++ b/book/src/generated/typable-cmd.md @@ -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 forcefully. Accepts an optional path (:wq! some/path.txt) | | `: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 forcefully (ignoring unsaved changes). | | `:quit-all`, `:qa` | Close all views. | diff --git a/helix-term/src/commands/typed.rs b/helix-term/src/commands/typed.rs index 5198e5bd..94cc33f0 100644 --- a/helix-term/src/commands/typed.rs +++ b/helix-term/src/commands/typed.rs @@ -739,6 +739,18 @@ fn write_all( 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( cx: &mut compositor::Context, _args: &[Cow<str>], @@ -2445,6 +2457,13 @@ pub const TYPABLE_COMMAND_LIST: &[TypableCommand] = &[ 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 { name: "write-quit-all", aliases: &["wqa", "xa"], doc: "Write changes from all buffers to disk and close all views.", |