Skip to main content
deleted 8 characters in body
Source Link
peterh
  • 1.2k
  • 3
  • 17
  • 36

Hey guys I'mI am trying to change the default grep call to avoid unnecessary plugin installation. What I want from vim is to call the external search using the builtin command :grep with custom arguments, this is what I've tried putting in my rc:

set wildignore=*.o,*.obj,*~,*.pyc,.git/**,tags,cscope* let &grepprg='grep -n -R --exclude=' . &wildignore . ' $*' 

usage:

:set verbose grepprg verbose=0 grepprg=grep -n -R --exclude=*.o,*.obj,*~,*.pyc,.git/**,tags,cscope* $* :lgrep "_cast" ./src/* 

output:

:!grep -n -R --exclude=*.o,*.obj,*~,*.pyc,.git/**,tags,cscope* "_cast" ./src/* 2>&1| tee /tmp/nvimzj3oo1/225 zsh:1: no matches found: --exclude=*.o,*.obj,*~,*.pyc,.git/**,tags,cscope* 

if I execute what vim tried:

$ grep -n -R --exclude=*.o,*.obj,*~,*.pyc,.git/**,tags,cscope* "_cast" ./src/* 2>&1| tee /tmp/nvimzj3oo1/225 ./src/daemon/lim_l3_server_mw.cc:160: LimL3Server *self = static_cast<LimL3Server *>(st); 

so, I'm falling to see the problem, any ideas?

Hey guys I'm trying to change the default grep call to avoid unnecessary plugin installation. What I want from vim is to call the external search using the builtin command :grep with custom arguments, this is what I've tried putting in my rc:

set wildignore=*.o,*.obj,*~,*.pyc,.git/**,tags,cscope* let &grepprg='grep -n -R --exclude=' . &wildignore . ' $*' 

usage:

:set verbose grepprg verbose=0 grepprg=grep -n -R --exclude=*.o,*.obj,*~,*.pyc,.git/**,tags,cscope* $* :lgrep "_cast" ./src/* 

output:

:!grep -n -R --exclude=*.o,*.obj,*~,*.pyc,.git/**,tags,cscope* "_cast" ./src/* 2>&1| tee /tmp/nvimzj3oo1/225 zsh:1: no matches found: --exclude=*.o,*.obj,*~,*.pyc,.git/**,tags,cscope* 

if I execute what vim tried:

$ grep -n -R --exclude=*.o,*.obj,*~,*.pyc,.git/**,tags,cscope* "_cast" ./src/* 2>&1| tee /tmp/nvimzj3oo1/225 ./src/daemon/lim_l3_server_mw.cc:160: LimL3Server *self = static_cast<LimL3Server *>(st); 

so, I'm falling to see the problem, any ideas?

I am trying to change the default grep call to avoid unnecessary plugin installation. What I want from vim is to call the external search using the builtin command :grep with custom arguments, this is what I've tried putting in my rc:

set wildignore=*.o,*.obj,*~,*.pyc,.git/**,tags,cscope* let &grepprg='grep -n -R --exclude=' . &wildignore . ' $*' 

usage:

:set verbose grepprg verbose=0 grepprg=grep -n -R --exclude=*.o,*.obj,*~,*.pyc,.git/**,tags,cscope* $* :lgrep "_cast" ./src/* 

output:

:!grep -n -R --exclude=*.o,*.obj,*~,*.pyc,.git/**,tags,cscope* "_cast" ./src/* 2>&1| tee /tmp/nvimzj3oo1/225 zsh:1: no matches found: --exclude=*.o,*.obj,*~,*.pyc,.git/**,tags,cscope* 

if I execute what vim tried:

$ grep -n -R --exclude=*.o,*.obj,*~,*.pyc,.git/**,tags,cscope* "_cast" ./src/* 2>&1| tee /tmp/nvimzj3oo1/225 ./src/daemon/lim_l3_server_mw.cc:160: LimL3Server *self = static_cast<LimL3Server *>(st); 

so, I'm falling to see the problem, any ideas?

edited tags; edited title
Link
Martin Tournoij
  • 64.3k
  • 27
  • 205
  • 280

(Nvim) How can I change the default grep call (grepprg) to exclude directories?

Source Link
MaikoID
  • 313
  • 2
  • 7

(Nvim) How can I change the default grep call (grepprg) to exclude directories?

Hey guys I'm trying to change the default grep call to avoid unnecessary plugin installation. What I want from vim is to call the external search using the builtin command :grep with custom arguments, this is what I've tried putting in my rc:

set wildignore=*.o,*.obj,*~,*.pyc,.git/**,tags,cscope* let &grepprg='grep -n -R --exclude=' . &wildignore . ' $*' 

usage:

:set verbose grepprg verbose=0 grepprg=grep -n -R --exclude=*.o,*.obj,*~,*.pyc,.git/**,tags,cscope* $* :lgrep "_cast" ./src/* 

output:

:!grep -n -R --exclude=*.o,*.obj,*~,*.pyc,.git/**,tags,cscope* "_cast" ./src/* 2>&1| tee /tmp/nvimzj3oo1/225 zsh:1: no matches found: --exclude=*.o,*.obj,*~,*.pyc,.git/**,tags,cscope* 

if I execute what vim tried:

$ grep -n -R --exclude=*.o,*.obj,*~,*.pyc,.git/**,tags,cscope* "_cast" ./src/* 2>&1| tee /tmp/nvimzj3oo1/225 ./src/daemon/lim_l3_server_mw.cc:160: LimL3Server *self = static_cast<LimL3Server *>(st); 

so, I'm falling to see the problem, any ideas?