Search code examples
unixgrepvi

Best way to combine `grep -n` output with `vim +`


This seems like something that could be quite useful and yet and I can't find the answer... The output of grep -n is something like this:

$ grep -inR Poinsot_1992 *
formulation_bc.tex:83:al.~\cite{Poinsot_1992a}, pressure is chosen over temperature as a convenient primitive
refs_final.bib:33594:@article{Poinsot_1992a,

How can I feed this to vim so that it opens these 2 files at the lines where the expression is found. Right now, I manually copy the line number which should not be necessary.

vim formulation_bc.tex +83

Can I modify the way grep outputs its results? Thanks in advance !


Solution

  • Other way 'round: the file:line plugin teaches vim to treat file:line like file +line.