@@ -1741,13 +1741,30 @@ fn insert_output(
17411741 Ok(())
17421742}
17431743
1744+fn pipe_to(
1745+ cx: &mut compositor::Context,
1746+ args: &[Cow<str>],
1747+ event: PromptEvent,
1748+) -> anyhow::Result<()> {
1749+ pipe_impl(cx, args, event, &ShellBehavior::Ignore)
1750+}
1751+
17441752fn pipe(cx: &mut compositor::Context, args: &[Cow<str>], event: PromptEvent) -> anyhow::Result<()> {
1753+ pipe_impl(cx, args, event, &ShellBehavior::Replace)
1754+}
1755+
1756+fn pipe_impl(
1757+ cx: &mut compositor::Context,
1758+ args: &[Cow<str>],
1759+ event: PromptEvent,
1760+ behavior: &ShellBehavior,
1761+) -> anyhow::Result<()> {
17451762 if event != PromptEvent::Validate {
17461763 return Ok(());
17471764 }
17481765
17491766 ensure!(!args.is_empty(), "Shell command required");
1750− shell(cx, &args.join(" "), &ShellBehavior::Replace);
1767+ shell(cx, &args.join(" "), behavior);
17511768 Ok(())
17521769}
17531770
@@ -2292,6 +2309,13 @@ pub const TYPABLE_COMMAND_LIST: &[TypableCommand] = &[
22922309 fun: pipe,
22932310 completer: None,
22942311 },
2312+ TypableCommand {
2313+ name: "pipe-to",
2314+ aliases: &[],
2315+ doc: "Pipe each selection to the shell command, ignoring output.",
2316+ fun: pipe_to,
2317+ completer: None,
2318+ },
22952319 TypableCommand {
22962320 name: "run-shell-command",
22972321 aliases: &["sh"],