Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/cute-jumper/epipe

A fork of vipe to support emacsclient
https://github.com/cute-jumper/epipe

Last synced: about 2 months ago
JSON representation

A fork of vipe to support emacsclient

Awesome Lists containing this project

README

        

#+TITLE: epipe

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.

* Usage
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, [[https://github.com/mooz/percol][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]]

* References
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.

- [[https://joeyh.name/code/moreutils/][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.
- [[https://github.com/juliangruber/vipe/][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
- Tested =epipe= on Arch Linux and GuixSD.
- Can't use with =-a= option of =emacsclient=