Justin M. Keyes wrote:
> On Mon, Aug 22, 2016 at 2:29 PM, Bram Moolenaar <[email protected]> wrote:
> >
> > David Fishburn wrote:
> >
> >> On Sat, Aug 20, 2016 at 12:37 PM, Bram Moolenaar <[email protected]>
> >> wrote:
> >>
> >> >
> >> > Patch 7.4.2231
> >> > Problem: ":oldfiles" output is a very long list.
> >> > Solution: Add a pattern argument. (Coot, closes #575)
> >> >
> >> >
> >> I was wondering if something similar to this could be added to the :let
> >> command (though it has a lot of permutations).
> >>
> >> I can do the following:
> >> :let g:
> >>
> >> I would love to do the following:
> >> :let g:loaded_db\w\+
> >>
> >> And return only those matching variables.
> >
> > Are we going to get this request for any command with a long output
> > list?
> >
> > Perhaps we better add a generic way to filter the output. Unfortunately
> > we can't use "command | grep /pattern/". Not all commands accept
> > another command following. We could put it in front:
> >
> > filter /pattern/ command
> >
> > It's like a command modifier then. But one with an argument.
> > Note that the filtering would happen line-by-line, thus if there is an
> > item that takes several lines only matching ones would show up.
>
> Why not use the conventions already built-in to Vim, i.e., ":global"?
> If :read was enhanced to take a colon-prefixed Vim command:
>
> :read :let
> :g!/foo/d
>
> all of these requests would be satisfied implicitly, as well as fix a
> long-standing omission of :read. And it also re-uses existing Vim
> concepts (":global" + buffer manipulation) instead of inventing new
> workarounds like :filter.
>
> Enhancing :read to treat colon-prefixed commands as Vim commands is
> analogous to the way read treats !-prefixed commands.
That's an interesting idea. It's already possible indirectly using
:redir. But having it in one command is more convenient. Well, with a
little bit of typing you can have it on one command:
:$put =execute('let')
And you could also filter that:
:$put =filter(split(execute('let'), '\n'), {i, v -> v =~ 'pat'})
But that is not something you would like to type.
However, we were discussing listing items, not changing the buffer.
Just like "ps | grep pattern" can be used to find something in a long
list.
--
"I can't complain, but sometimes I still do." (Joe Walsh)
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
--
You received this message from the "vim_dev" 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_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.