Skip to content
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

Clarify readme #1

Open
tremby opened this issue Nov 21, 2014 · 9 comments
Open

Clarify readme #1

tremby opened this issue Nov 21, 2014 · 9 comments

Comments

@tremby
Copy link

tremby commented Nov 21, 2014

The readme says that git-grep will be used if present, otherwise ag, otherwise ack, otherwise regular grep.

Then the instructions say to install ag, and set g:grepprg to ag.
Then to install ack, and set g:grepprg to ack. But then why did I set it to ag? Which one should it be set to? Isn't the whole point to use git-grep first, then fall back to each alternative?

From looking at the code it seems the only reason to set that variable is if I do not want to the fallback behaviour.

@teoljungberg
Copy link
Collaborator

The fallback-behavior is only present if g:grepprg isn't set, as you said. So if you override that with your own grep-program you have decided that that's what you want. Both ag and ack work outside a git-repository, git-grep doesn't. That's why the fallback is there, and that's why it does not do any fallback if you have set your own grep-program

@tremby
Copy link
Author

tremby commented Nov 22, 2014

What if I want to use ag by default and fall back to ack or grep if it's
not there, for example if I'm on another server where I can't install them
ag or ack?

@teoljungberg
Copy link
Collaborator

That would require something like a linked-list to favor certain services over others, and I would rather not do that. Mainly due to personal opinions of people, I hesitated with having the fallback-behaviour due to the same reason. I just took what I wanted for myself

I don't see a good solution to this, sorry..

@tremby
Copy link
Author

tremby commented Nov 22, 2014

Well in that case I don't see the point in using your plugin and
configuring it to use a particular grepping program at all. Isn't it
identical to just setting the grepping command directly with a single line
in your vimrc?

Of course, I do see the point if a user's preferences are the same as your
own.

@teoljungberg
Copy link
Collaborator

The idea with the fallback was to provide a sane default to the user, and I don't see it as a problem if you specify a grep-command of your own - you have decided on that command.

Feel free to make a pull-request if you find out a solution to this

@teoljungberg
Copy link
Collaborator

@tremby would it work for you if you could specify your fallback?

@tremby
Copy link
Author

tremby commented Nov 23, 2014

I'm actually okay with your defaults: git, then ag, then ack, then grep.

I just remain confused about what the point of being allowed to specify g:grepprg is at all, since when specified it appears to function exactly the same as not having the plugin installed and specifying the regular vim option grepprg. So I suppose I'm suggesting removing the option entirely (if I'm right that it adds nothing) and perhaps, yes, allowing the fallback chain to be configured.

@teoljungberg teoljungberg reopened this Nov 23, 2014
@teoljungberg
Copy link
Collaborator

@tremby What do you think of doing something like - https://github.com/teoljungberg/vim-grep/tree/configure-callback ?

@tremby
Copy link
Author

tremby commented Jun 1, 2015

I think that's more useful than the current behaviour.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants