I often open the results of an external project-wide find | xargs grep
command into a new tab like this :tabnew|read !find . -iname \*.py | xargs grep -n 'pattern'
I then use gf
to open the matching files and perform edits. While this is handy, the file opens with the cursor on the top-most line of the file.
I want to be able to jump directly to the exact line as indicated by the results (note the use of grep -n
to include line numbers in the results).
Is it possible to "promote" or "convert" the results of the command to a quickfix or location list?
Or, conversely, is there a command other than gf
that will jump to not only the file but the exact line in the file as indicated by the results?
[Edit: I know of :vimgrep /pattern/ **/*.py
but I don't know how to tell it not to follow symlinks (whereas find
won't follow links unless -L
is specified). There's also the problem of **
exhausting the command buffer if there are too many files... hence why I use find | xargs grep
.]