0

I often run a command such as this from within vim:

:grep -r --exclude-dir=./.git --include=\*.cpp --include=\*.hpp .

But I would like to not have to write this everytime I want to grep within vim, so I tried adding the following to my .vimrc file:

command GrepRepo grep -r --exclude-dir=./build --exclude-dir=./.git --include=\*.cpp --include=\*.hpp .

But then when I run GrepRepo "STRING" it just comes back blank. What am I doing wrong?

0

Try this version of your command:

:command! -nargs=+ GrepRepo grep -r --exclude-dir=./build --exclude-dir=./.git --include=\*.cpp --include=\*.hpp . <args>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.