diff options
author | Thomas | 2022-04-17 03:03:47 +0000 |
---|---|---|
committer | GitHub | 2022-04-17 03:03:47 +0000 |
commit | 2eca2901f31083af85ffd6f299c64ad80a8bfaf5 (patch) | |
tree | db27d589dd6e85f009adc43391805b70f177098b /helix-term/src/commands | |
parent | dc8fef5dd311e239150dfcd62c90cc84ee32a8a0 (diff) |
Pipe typable command (#1972)
Co-authored-by: DeviousStoat <devious@stoat.com>
Diffstat (limited to 'helix-term/src/commands')
-rw-r--r-- | helix-term/src/commands/typed.rs | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/helix-term/src/commands/typed.rs b/helix-term/src/commands/typed.rs index d158388f..9a5298bb 100644 --- a/helix-term/src/commands/typed.rs +++ b/helix-term/src/commands/typed.rs @@ -1067,6 +1067,16 @@ fn refresh_config( Ok(()) } +fn pipe( + cx: &mut compositor::Context, + args: &[Cow<str>], + _event: PromptEvent, +) -> anyhow::Result<()> { + ensure!(!args.is_empty(), "Shell command required"); + shell(cx, &args.join(" "), &ShellBehavior::Replace); + Ok(()) +} + pub const TYPABLE_COMMAND_LIST: &[TypableCommand] = &[ TypableCommand { name: "quit", @@ -1495,6 +1505,13 @@ pub const TYPABLE_COMMAND_LIST: &[TypableCommand] = &[ fun: open_config, completer: None, }, + TypableCommand { + name: "pipe", + aliases: &[], + doc: "Pipe each selection to the shell command.", + fun: pipe, + completer: None, + }, ]; pub static TYPABLE_COMMAND_MAP: Lazy<HashMap<&'static str, &'static TypableCommand>> = |