3

I'm using the Fugitive plugin. It has the :Ggrep command which is very useful for searching the repo.

One annoying thing is that I have huge .map files and I want to omit them from my search. I cannot modify the .gitignore and other files, I can only modify what's related to vim.

I'm using this:

:Ggrep foobar -- './*' ':(exclude)*.map'

How can I tell vim to always append -- './*' ':(exclude)*.map' and just write:

:Ggrep foobar

every time I'm searching for foobar?

3

While I don't think it's possible out of the box, you can work your way around this:

command! -nargs=1 GGrep Ggrep <q-args> -- './*' ':(exclude)*.map'

Then use the GGrep command instead of Ggrep:

:GGrep foobar

See:

  • :h command
  • :h nargs
  • :h <q-args>
  • A creative solution, very nice, thanks :) – valk Dec 27 '16 at 11:20

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.