[dev] [st] terminal as a pipe reader

0 views
Skip to first unread message

avidseeker

unread,
Aug 22, 2025, 2:56:03 AMAug 22
to d...@suckless.org
I'm looking for a way emulate stdin-stdout editor in st.

In an already existing terminal emulator this is simply done by:
$ cmd1 | vipe | cmd2

But my goal is to have
$ cmd1 | st -e 'vipe' | cmd2
ran non-interactively (i.e: in a shell script).

Use case: click on a dunst notification to launch it in Vim running on
st and have the output piped into some other script after Vim and st
close.

Footnote: vipe is from moreutils:
NAME
vipe - edit pipe

SYNOPSIS
command1 | vipe | command2

DESCRIPTION
vipe allows you to run your editor in the middle of a unix
pipeline and edit the data that is being
piped between programs. Your editor will have the full data being
piped from command1 loaded into
it, and when you close it, that data will be piped into command2.

Avid,

syg

unread,
Aug 22, 2025, 4:38:57 AM (14 days ago) Aug 22
to dev mail list
Hi,

> $ cmd1 | st -e 'vipe' | cmd2

You could make a script that saves stdin in a temp file, starts st with
vim and the file name, then once st returns, output the temp file in
stdout and delete it.

The following does exactly what you want:

```
#!/usr/bin/sh

FILE="$(mktemp)"
cat > "$FILE"

st -e vim "$FILE"

cat "$FILE"
rm "$FILE"
```

- syg

Mick Phillips

unread,
Aug 22, 2025, 5:53:47 AM (14 days ago) Aug 22
to d...@suckless.org
Hello,

> But my goal is to have
> $ cmd1 | st -e 'vipe' | cmd2
> ran non-interactively (i.e: in a shell script).

I use vipe a lot, but not this specific use case previously. Still, vipe supports the EDITOR variable, and this seems to work okay for me:

```
echo hello | EDITOR='st -e vim' vipe
```

No doubt this could be turned into a shell alias or so.


Reply all
Reply to author
Forward
0 new messages