-
-
Notifications
You must be signed in to change notification settings - Fork 584
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
Add GitGrep command #36
Conversation
That looks almost identical to Ag, right? Maybe we could generalize the concept into a versatile command that can be used with |
Yeah, I just copied the Ag command. Generalizing it sounds like the right idea. |
What do you think about renaming |
That would allow users to temporarily change function! s:Ag()
" store original grepprg and grepformat
" change grepprg....
" call grep
" restore original options
endfunction |
That's a good point, adding a generalized version of Incidentally, I have |
@junegunn Sorry to bother you, but would you be opposed to at least option to replace ag command there? I've tested three tools: |
@LK4D4 That is based on the assumption that the other commands 1. take the same set of options (which is not true for the new rg), 2. and print the output in the same format as ag. I'll see if it's viable to add a generalized grep function that takes the full command. The command is also responsible for transforming the output so the same sink function can be applied. |
Hey @junegunn in regards to the above comment and a generalised grep function will a new issue be opened for this? Asking simply in regards to tracking progress. Cheers. |
@CrashyBang No need. I'm working on it, coming soon. |
I'm almost done but there's a few issues.
|
Hey @junegunn, Cheers for letting me know, should I post an issue against Cheers. |
Lol that's dope |
No idea why rg doesn't work well in this context, but it's a separate issue anyway. This is how the new " git grep and gnu grep do not print column number so with_column is 0
command! -bang -nargs=* GGrep call fzf#vim#grep('git grep --line-number '.shellescape(<q-args>), 0, <bang>0)
command! -bang -nargs=* Grep call fzf#vim#grep('grep -r --line-number '.shellescape(<q-args>).' *', 0, <bang>0) |
Hey @junegunn got this working with I am using the following command which works perfectly except for one thing: command! -bang -nargs=* Find call fzf#vim#grep('rg --vimgrep --fixed-strings --ignore-case --no-ignore --hidden --follow --glob "!.git/*" '.shellescape(<q-args>), 1, <bang>0) It does not highlight the search term like Cheers, |
rg seems to ignore So without # Compare these
echo foobar | ag --color foo | more
# ESC[30;43mfooESC[0mESC[Kbar
echo foobar | rg -N --color=always foo | more
# ESC[91mESC[1mfooESC[m^Obar (on tmux)
# ESC[91mESC[1mfooESC(BESC[mbar (not on tmux) If that extra |
Hey @junegunn looks good to me, would you like me to open an issue with rg? Or would you be better suited? |
Do as you please. FYI, we can make it work without changing rg or fzf.vim by filtering out the character with command! -bang -nargs=* Find
\ call fzf#vim#grep('rg --column --line-number --no-heading --color=always '.shellescape(<q-args>).'| tr -d "\017"', 1, <bang>0) |
Trying to make it work. But no, this implementation is not faster than @junegunn implementation with Ag in fzf.vim. Just want to make sure, there won't be native :Rg command in this plugin right? Thanks. |
Using sample Rg implementation in Readme, when I'm using :Rg its count total files longer than using :Ag command. The result is come late too. |
I don't know, I just use |
Yeah, better stick with Ag :) |
@rawaludin I'm having this same problem - did you ever figure it out? Running |
Is there a way to do this without adding a command?