wigust / epipe

A fork of vipe to support emacsclient

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool


Use your favorite editor in the pipeline, featuring the support for running emacsclient in the terminal.

This tool enables the use of emacs(client) for interactive editing of the output/input of shell commands.


First, set an alias for epipe:

alias epipe=/path/to/epipe

Then you can use epipe in one of the following ways:

command1 | epipe
epipe | command1
command1 | epipe | command2

Since emacs can now be used in the pipeline, epipe saves us from writing grep, sed, awk, etc., in order to process the output/input of shell commands. The use of epipe can also replace some other interactive commands, for example, the interactive grep, percol.

You need to set either EDITOR or VISUAL environment variable. If you don’t set EDITOR or VISUAL, epipe uses emacs as the default editor. In order to use emacsclient as the editor, you can set EDITOR environment variable:

export EDITOR="emacsclient -ct"

A really simple example: ./epipe.gif


This idea has been implemented in vipe, but none of the current implementation supports emacsclient in the terminal. That said, setting EDITOR to emacsclient -t doesn’t work for vipe while setting EDITOR to emacsclient works since it creates/uses the frame in the window system instead of the current terminal.

  • vipe of moreutils: To the best of my knowledge, the original vipe is implemented by Joey Hess using perl. But it doesn’t support running emacsclient in the terminal.
  • juliangruber/vipe: I found this repo after I wrote the code. This one is similar to epipe since the author also rewrote the original vipe of Joey Hess using shell script. However, the problem remains the same – it doesn’t support running emacsclient in the terminal.

Perl Version

I also put a modified verion of Joey’s vipe in this repo: epipe.pl. The code of vipe is changed a little bit to support emacsclient. You can check it out if interested.

Final Notes

  • Only test epipe on Arch Linux.
  • Can’t use with -a option of emacsclient


A fork of vipe to support emacsclient

License:GNU General Public License v3.0


Language:Perl 78.6%Language:Shell 21.4%