Saturday, July 24, 2010

Re: improving on the standard :grep behavior...

Hi,

On Sat, Jul 24, 2010 at 5:32 PM, Britton Kerin <britton.kerin@gmail.com> wrote:
> I'm trying to tune the behavior of :grep.
>

You can try using the following Vim plugin that integrates the grep
utilities with Vim:

http://www.vim.org/scripts/script.php?script_id=311

>
> The things I'm trying to fix, and the solutions I have, if any:
>
>   1.  Don't like the big list vim spits up (solution: use silent command)
> 2. Don't want to auto-jump to first match (no solution yet)
> 5. Want :copen to happen automatically after grep (solution: use custom
> command and function).
>

The above features are supported by the plugin.

- Yegappan

>
>   3.  Want context (--context option to grep) (solution: add --context
>        (to 'grepprg' and %f-%l- to grepformat so :copen buffer lines are
>        justified consistently)
>
>   4. Unfortunately, doing 3 solution causes context lines to be considered
>       matches by vim (no easy solution)
>
>   6. Want :match called automatically in Quickfix buffer for searched pattern
>       (solution: use custom command and function).
>
>   7. Actually, solution to 6 isn't quite what I want, I'd like it to
> behave as if I
>       typed '/<pat>' in quickfix so n, N, etc. work (no solution yet).
>
>   8. From command line, I often refilter grep output (e.g.
>       grep --with-filename foo | grep --invert-match 'foo\.autogenerated')
>       I would like to be able to do this from within vim.  For this
> the secondary
>       filter is usually simple so I don't care if its vim regex
> rather than POSIX/perl
>       I'm used to that external grep provides). (no solution yet).
>
> The code that implements the above partial solutions is shown below.
>
> It looks like some of the remaining problems 3/4 and 8 could be addressed
> using filter (!) or just rewriting the buffer, but I guess changing the Quickfix
> buffer contents might break other things?
>
> Any ideas greatly appreciated.
>

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

No comments:

Post a Comment