I have used the moreutils suite a few times and I find it makes you think further about base utilities and is insightful(and fun). For instance, vipe allows running an editor - like vim - in the middle of a pipeline and editing the data before continuing the execution1. For instance:
function refcheck_vipe() { echo -n "$@ documentation last udate: "; links -dump "http://www.gnu.org/software/$@/manual"| vipe | grep 'last updated' | vipe | cut -d ' ' -f 7,8,9 | vipe ; }
# refcheck_vipe grep
Every time(3) vipe is arbitrarily placed in the pipeline, and therefore called, you are presented with the data in vim, and once you quit, the execution continues. So here you'll get the webpage, the matched line and finally the isolated string. Maybe what is missing is that I keep the used buffers along the way to compare the contents in some cases...
I did not know you could multiplex the layout of the buffers in vim(!). Now I wonder if I were to launch my command on the vim cli, could there be a way to redirect every vipe execution "step" to a different buffer. And allow the tmp file to continue displaying the contents in some way after I quit. Indeed, you must do :q for the execution to continue until the next "step" so I don't know how to reconcile what I've just said with this. On the other hand I note that I can do :split new then :r! ls and the output of this goes into that.
To summarize and add context, I'm thinking about something like this:
command1 | vipe1 | command2 | vipe2 | command n | vipe n
would be wrapped by the answer to produce this in vim(the vipe part):
-------------------------
| | | | A buffer would open to the right side
| vipe | vipe | vipe | for every vipe command in the pipeline.
| step1 | step..| step n|
| | | |
| | | |
-------------------------
| | | Bottom left you see a "file manager".
|find . | \ | whatever | Its contents could be refreshed, from
|vidir - | | time to time.
-------------------------
:cli
I know vim is not a window manager or multiplexer. The goal here is showcasing the processing of data in shell commands, while improving my vim skills2. The focus is vim, but considering vipe reads the EDITOR variable, I would also read with interest a solution leveraging emacs.
So is there some alias/function/setup I could implement to accomplish what I have described(allowing comparison of the output I get in a sort of integrated way by adding buffers visually to the right side in the editor, for every vipe command in the pipeline)?
1. If I string together some commands with regular expressions and it doesn't work(often the case), I'll backtrack, removing commands and simplifying expressions in the pipeline until I can isolate the issue. So vipe can assist in some cases.
2. As well as coping with the scenario where I have to use a system and Openbox or i3 is not present!!
[..] Not referenced but making an appearance in the code sample, vidir.
$EDITORand waits until it ends. You need either replacevipeor write a custom $EDITOR script which opens a tab in an existing vim and waits until the temporary file is changed.vipeis a perl script and I get a general idea looking at it but that's it. So a subset question becomes how do you interrupt arbitrarily the execution of a pipeline of commands in the shell and send the output to the editor and wait for it to exit, i.e. what you're saying. And how to manipulate the layout of the editor accordingly...