vile
[Top][All Lists]
Advanced

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

Re: [vile] auto-filtered text?


From: Paul Fox
Subject: Re: [vile] auto-filtered text?
Date: Sat, 01 Jul 2017 08:17:13 -0400

brendan wrote:
 > On 1 July 2017 at 01:30,  <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
 > >
 > > 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 can't think of a way offhand to do that, but you can map a character
 > to apply the filter at the end of each line.  For example:
 > 
 >   map! ^X^M ^[!!tr A-Z a-z^Mo

nice trick.

i'm no expert on mapping, but would setting :noremap let one apply
the above mapping to ^M directly, rather than ^X^M?

paul

 > 
 > Note that those need to be literal control characters (see attached).
 > 
 > In this trivial example, I've mapped ^X-RET to exit insert mode,
 > filter the line through tr to down case the letters, then open a new
 > line.  So if you were to source the attached file, then enter the
 > sequence:
 > 
 >   ABC
 >   DEF
 > 
 > and end each line with ^X-RET (rather than just RET), then the buffer
 > will contain
 > 
 >   abc
 >   def
 > 
 > and you should see each line changing case as you move to the next line.
 > 
 > Note (and a question for Tom), for some reason this doesn't work quite
 > as I would expect when the cursor is on the first line of the window:
 > the new line is scrolled off the top of the window as opposed to just
 > hitting RET, which leaves the new line as the first line of the window
 > and advances the cursor.
 > 
 > --bod
 > _______________________________________________
 > vile mailing list
 > address@hidden
 > https://lists.nongnu.org/mailman/listinfo/vile


=----------------------
paul fox, address@hidden (arlington, ma, where it's 67.6 degrees)




reply via email to

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