Created
May 2, 2023 17:34
-
-
Save andlrc/c8e1a3b9c1ec5c761111ea0e49bda6c4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" dyngrepprg - set "grepprg" to dynamically when inside a git repository | |
" Maintainer: Andreas Louv <andreas@louv.dk> | |
" Date: 3 Aug 2018 | |
augroup DynGrepPrg | |
au! | |
au DirChanged * call <SID>SetGrepPrg() | |
augroup END | |
function! s:SetGrepPrg() | |
if system('git rev-parse --show-toplevel 2> /dev/null') !~ '^\s*$' | |
set grepprg=git\ grep\ -n\ --column\ $* | |
else | |
set grepprg=grep\ -nH\ --exclude={\\*.o,tags} | |
\\ --exclude-dir={node_modules,.git} | |
\\ $* | |
endif | |
endfunction | |
call s:SetGrepPrg() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment