forked from mileszs/ack.vim
-
Notifications
You must be signed in to change notification settings - Fork 131
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
Don't clobber global grepprg, or quickfix mappings #90
Open
ches
wants to merge
5
commits into
rking:master
Choose a base branch
from
ches:use-local-grepprg
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
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
'grepprg' is a buffer-local setting. We should only use the `&l` version, or else when we restore it after an `:Ag` command, we're disrupting the setting in other buffers. It's surprising that 'grepprg' is local and global, and 'grepformat' is only global, so we have no choice but to clobber it. But this could have it's uses: suppose you have a C program with some tests in shell (like ag!), and you always use `ag` for 'grepprg'. The same 'grepformat' can work project-wide, but you might have an autocommand that makes 'grepprg' use `ag --shell` for all files under the tests directory.
`<buffer>` *must* come first. This was leaving the mappings set in all normal quickfix windows, which is not our place to impose on users.
ches
changed the title
Don't clobber global grepprg
Don't clobber global grepprg, or quickfix mappings
Feb 7, 2015
Looks much better as code than a one-line string, doesn't it?
The last commit here was a little cleanup of a bug I left earlier. I'll squash the commits if this otherwise meets review approval. Is there anything controversial here? |
Wow, nice work. I have lots of questions (sorry in advance lol).
Some style comments/preferences (these are up for debate, but I'd prefer at least consistency if we choose something else):
Other thoughts that might not pertain:
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
'grepprg'
is a buffer-local setting. We should only use the&l
version, or else when we restore it after an:Ag
command, we're disrupting the setting in other buffers.It's surprising that
'grepprg'
is local and global, and'grepformat'
is only global, so I guess we have no choice but to clobber it. Perhaps this has it's uses: suppose you have a C program with some tests in shell (or cram, etc., like ag!), and you always useag
for'grepprg'
. The same'grepformat'
can work project-wide, but you might have an autocommand that makes'grepprg'
useag --shell
for all files under the tests directory.Anyway, it's kind of pathological, but we just shouldn't clobber a global setting when local can be used. I was working on something else when I made the small changes here, but that's going to warrant deeper review discussion when it's ready I think, so I went ahead and isolated these changes.
Update: I realized the
<buffer>
mappings were broken too,<buffer>
must be given first or it doesn't work. Fix included.