Thursday, February 9, 2017

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

On 2017-02-09, Justin M. Keyes wrote:
> On Thu, Feb 9, 2017 at 5:49 PM, Sylvain Leroux <sylvain@chicoree.fr> wrote:
> > Thank you for your reply Bram,
> > And more generally thank you for your great work & continuous
> > involvement with Vim.
> >
> >
> > Some comments inline:
> >
> > On 02/09/2017 04:06 PM, 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
> >
> > I was out of idea when I posted yesterday, but there is indeed a simple
> > workaround at least on some Unix-like systems:
> >
> > :{range}! tee >(wc -l)
> >
> > But I agree a more generic/cross-platform solution would be better.
> >
> >> Would not be a bad idea to have an Ex command for this. Not sure what
> >> to call it, :feed perhaps? :writeread ?
> >>
> >
> > For a really generic solution, the command should support a source range
> > and a destination range-or-address. At some point while experimenting I
> > thought there could be an option to the `!r` command.
> >
> > Here is what I had in mind:
> >
> > :{range-1}r[read]>[range-2] !{filter}
> >
> > But, as you suggested, we may envision some new `feed` command instead:
> >
> > :{range-1}fee[d][range-2] !{filter}
> >
> > {range-1} is the destination range as specified for the `read` command.
> > [range-2] is the source range whose content is written on {filter} input
> > stream. [range-2] is optional and is equal to {range-1} if not specified.
> >
> >
> > What do you think of that?
>
> I would really prefer some variation or enhancement to :! or :read
> rather than *yet another* narrow, special-purpose command (:feed,
> :writeread) with no discoverability or intuitive nature.
>
> Usability takes thought and deliberation. Every time someone asks for
> a random feature the solution should not be "let's add a new
> :dothisonething command". And yes, the usable/intuitive approach might
> take more work.

Excellent point. I'll try to find time today to contribute more
than enthusiasm.

Regards,
Gary

--
--
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