Is it possible to use zsh's built-in line editor (zle
) to feed input to a subprocess? That is, I would like to run zlewrap mycommand
where zlewrap
is a zsh function and mycommand
is any program that just reads lines from stdin; zlewrap
would effectively provide zle's line-editing capabilities to mycommand
. This is on the model of rlwrap
which does just this, but with readline and not zle for line editing.
Tell me more
×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.
|
||||
show 1 more comments |
Here is how you can do it if using GNU screen: Put a file called "zf" in your $PATH with:
And then, run the filter in screen as
Replace /dev/pts/x with the actuall Windows pty (output of tty comand in the window), and "> " with the prompt to display. There will be occasional display glitches as both zsh and the application will write to the terminal in an unconcerted way. Original at http://www.zsh.org/mla/users/2005/msg00186.html | ||||
|
rlwrap
is quite widespread and you've probably used it. Think about the little pseudo shell things you get in things like mysql, sqlite, lftp, etc. They all have some implementation of a line editor that returns on line or block of lines at a time to the actual processor behind them.rlwrap
does hits quite neatly for any program that accepts STDIN, but it would be nice to have zle style bindings and abilities rather than readlines which are someone less extensive. – Caleb Jan 7 '12 at 23:26zsh
- cs.elte.hu/zsh-manual/zsh_14.html? - I don't quite understand your question, but Googled the title, and found that page. It might help, but I don't know. – Kevdog777 Aug 22 '12 at 8:33