Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how use ‘git grep’ in ag.vim? #116

Open
kdurant opened this issue Oct 15, 2015 · 2 comments
Open

how use ‘git grep’ in ag.vim? #116

kdurant opened this issue Oct 15, 2015 · 2 comments

Comments

@kdurant
Copy link

kdurant commented Oct 15, 2015

let g:ag_prg="git grep -n", it works, but can't use command to open file

I want use jump command to open file

@losingkeys
Copy link
Collaborator

This plugin overrides vim's builtin 'errorformat' option temporarily so vim parses ag's output correctly. You can adjust what ag.vim uses with the g:ag_format option.

Vim's default value should work fine (see it with set errorformat?, vim 7.4.889's value for this option is below):

set errorformat=%*[^"]"%f"%*\D%l: %m,"%f"%*\D%l: %m,%-G%f:%l: (Each undeclared ide
ntifier is reported only once,%-G%f:%l: for each function it appears in.),%-GIn
file included from %f:%l:%c:,%-GIn file included from %f:%l:%c\,,%-GIn file incl
uded from %f:%l:%c,%-GIn file included from %f:%l,%-G%*[ ]from %f:%l:%c,%-G%*[ ]
from %f:%l:,%-G%*[ ]from %f:%l\,,%-G%*[ ]from %f:%l,%f:%l:%c:%m,%f(%l):%m,%f:%l:
%m,"%f"\, line %l%*\D%c%*[^ ] %m,%D%*\a[%*\d]: Entering directory %*[`']%f',%X%*
\a[%*\d]: Leaving directory %*[`']%f',%D%*\a: Entering directory %*[`']%f',%X%*\
a: Leaving directory %*[`']%f',%DMaking %*\a in %f,%f|%l| %m

Leaving this issue open. We could parse the value of g:ag_prg and try to choose from a list of known errorformats based on its value (e.g. for grep, ack, find, whatever).

@kdurant
Copy link
Author

kdurant commented Oct 29, 2015

vim 7.4 1-460patch

 errorformat=%f(%l) : %t%*\D%n: %m,%*[^"]"%f"%*\D%l: %m,%f(%l) : %m,%*[^ ] %f %l: %m,%f:%l:%c:%m,%f(%l):%m,%f:%l:%m,%f|%l| %m

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants