On 07.05.13 10:58, Gary Johnson wrote:
> On 2013-05-08, Erik Christiansen wrote:
> You might find this script, which I've named vimgrep, useful.
> 
>     #!/bin/bash
> 
>     tmp=$(mktemp)
> 
>     cat > $tmp
>     exec < /dev/tty
>     vim --cmd 'let &efm=&gfm' -q $tmp "$@"
>     rm $tmp
> 
> It's invoked like this:
> 
>     grep -Hn <whatever other options and files you want> | vimgrep

That hangs here, because /dev/tty is not used. (Confirmed by fuser)
Depending on which xterm it's invoked in, it'll be /dev/tty1 ... 6.
If I knew what the redirection is expected to achieve, then we could
probably hack something which works.

> All the lines that grep finds will be fed to vim as a quickfix list,
> which you can traverse with :cn, :cp, etc., or browse with :copen.

That's what I was trying to get away from, because (as described) it was
very clumsy to step blindly through the helpgrep hits, using those
commands. I have now tried your :copen suggestion with helpgrep, but
that splits the window into 3, introducing a great deal if visual
clutter.

My method is much more attractive, in that it keeps the list of search
hits visually separate, avoids those cluttered vim window splits, and
allows any regex. (Helpgrep seemed very limited in that regard when I
tried it, just now.) Keeping the list in a separate buffer, and using
"gf", re-uses vim commands which I use a lot. When trying the quickfix
alternative, the need to both ":q" _and_ ":ccl", to get rid of the
window splits, is also annoying.

But thank you for the suggestion. It's always interesting to try an
alternative.

Erik

-- 
Behavioural psychology is the science of pulling habits out of rats.
                                                  - Dr. Douglas Busch

Reply via email to