On 1 July 2017 at 01:30, <[email protected]> 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 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
foo.rc
Description: Binary data
_______________________________________________ vile mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/vile
