[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [vile] auto-filtered text?

From: Thomas Dickey
Subject: Re: [vile] auto-filtered text?
Date: Fri, 30 Jun 2017 15:25:23 -0400
User-agent: Mutt/1.5.21 (2010-09-15)

On Fri, Jun 30, 2017 at 11:30:23AM -0400, address@hidden wrote:
> Let's say I input 10 lines of text, and then I need to filter that text
> through a specific command.  So I go to the top line and do this
> :,+9!command

In vile.hlp, that's

   Anywhere a filename is valid, a command name is also valid, entered in the
   form "!shell-command". The whole line is handed to the shell, and the read
   or write operation is done on the commands standard input or output, as
   appropriate. Thus you can type ":e !date" to edit a copy of today's date.

   The ": !cmd" shell escape works pretty much as it does in vi. The command
   ":!!" will rerun the previous such shell command.

   The '!' operator works as a filter, as expected.

(I noticed a missing "'" just in answering...)

> Is there a way that I can save a step -- some kind of special "i" or "o"
> command that will run a filter on each line of text as I enter it?

I don't believe you can do this (without some change to vile).
The I/O connections in that area are "hard", not "soft" (scriptable).

Pipes are one-direction; vile's using pipes...

> I'm vaguely familiar with ^X-! , but as far as I can tell, it doesn't
> pass stdin to the command.

right - that opens a pipe to the command, duplicating the output onto
the error file-descriptor (so but stdout/stderr are captured).
That's done in npopen.c:

Thomas E. Dickey <address@hidden>

Attachment: signature.asc
Description: Digital signature

reply via email to

[Prev in Thread] Current Thread [Next in Thread]