Friday, February 10, 2017

Re: Filter-like command -- but to insert instead of replacing

On 2017-02-09 16:06, Bram Moolenaar wrote:
> I don't think it can be done with one command. Simplest seems to
> be to copy the text and then filter it.
> (visually select the text)
> YP
> gv
> :!filter-command
>
> Would not be a bad idea to have an Ex command for this. Not sure
> what to call it, :feed perhaps? :writeread ?

With three input parameters (source range, destination location, and
command to execute), I'm unaware of anything that currently does
this. Fortunately, copying should also set the '[ and '] marks, so
something similar to the above would work even in builds without
visual mode:

:{range}t{destination}
:'[,']!{filter-command}

If it's limited to putting input at a given line, I'd want/expect the
full power of ex range/line specifiers, allowing for complex offsets
like

:{range}cmd?^TABLE OF CONTENTS$?+1 {filter-command}

(such as :t and :m allow for targets)

That said, it's not that hard to use the pair of commands above (or
map it or make a :command), so I don't see a great need for a new
built-in to do the same.

-tkc


--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment