aboutsummaryrefslogtreecommitdiff
path: root/helix-term/src
diff options
context:
space:
mode:
authorTermina942022-06-05 10:52:41 +0000
committerGitHub2022-06-05 10:52:41 +0000
commitf1ae496860e10560d9a8b91a721168524411096a (patch)
treec01cdbc92f01c4cad005cc88809ca3e5edf1b76c /helix-term/src
parentf92a25a856d572c7bd4b8e597a3f86ce211e81d5 (diff)
Add shell insert commands to typable and config (#2589)
* Add shell insert commands to typable and config * generate docs Co-authored-by: Dean Revell <revell@gmail.com>
Diffstat (limited to 'helix-term/src')
-rw-r--r--helix-term/src/commands/typed.rs34
1 files changed, 34 insertions, 0 deletions
diff --git a/helix-term/src/commands/typed.rs b/helix-term/src/commands/typed.rs
index fd33e6b4..0f8884db 100644
--- a/helix-term/src/commands/typed.rs
+++ b/helix-term/src/commands/typed.rs
@@ -1172,6 +1172,26 @@ fn refresh_config(
Ok(())
}
+fn append_output(
+ cx: &mut compositor::Context,
+ args: &[Cow<str>],
+ _event: PromptEvent,
+) -> anyhow::Result<()> {
+ ensure!(!args.is_empty(), "Shell command required");
+ shell(cx, &args.join(" "), &ShellBehavior::Append);
+ Ok(())
+}
+
+fn insert_output(
+ cx: &mut compositor::Context,
+ args: &[Cow<str>],
+ _event: PromptEvent,
+) -> anyhow::Result<()> {
+ ensure!(!args.is_empty(), "Shell command required");
+ shell(cx, &args.join(" "), &ShellBehavior::Insert);
+ Ok(())
+}
+
fn pipe(
cx: &mut compositor::Context,
args: &[Cow<str>],
@@ -1672,6 +1692,20 @@ pub const TYPABLE_COMMAND_LIST: &[TypableCommand] = &[
completer: None,
},
TypableCommand {
+ name: "insert-output",
+ aliases: &[],
+ doc: "Run shell command, inserting output after each selection.",
+ fun: insert_output,
+ completer: None,
+ },
+ TypableCommand {
+ name: "append-output",
+ aliases: &[],
+ doc: "Run shell command, appending output after each selection.",
+ fun: append_output,
+ completer: None,
+ },
+ TypableCommand {
name: "pipe",
aliases: &[],
doc: "Pipe each selection to the shell command.",