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

Option to make Ack not replace current buffer with first matched file #31

Closed
AndrewRayCode opened this issue Nov 1, 2011 · 7 comments
Closed

Comments

@AndrewRayCode
Copy link

When I'm acking for something it is VERY rare that I want to lose my current place in my open tab, I just want to see the usages of some word or phrase. By default Ack will overwrite your buffer with the first match and I can't seem to find a way to turn this off. It's very annoying frankly, if I forget to open a new tab before acking I lose my place and have to go buffer hunting.

@czak
Copy link

czak commented Nov 1, 2011

Use :Ack! instead of :Ack :)

@AndrewRayCode
Copy link
Author

:Ack! word

"No ! allowed"

@czak
Copy link

czak commented Nov 1, 2011

That should work, see here: https://github.com/mileszs/ack.vim/blob/master/doc/ack.txt

:Ack[!] [options] {pattern} [{directory}]                               *:Ack*

    Search recursively in {directory} (which defaults to the current
    directory) for the {pattern}.  Behaves just like the |:grep| command, but
    will open the |Quickfix| window for you. If [!] is not given the first
    error is jumped to.

@AndrewRayCode
Copy link
Author

Hm, I don't know. I'll check to see if there's time before dinner.

(I'm probably using an older version)

@AndrewRayCode
Copy link
Author

Ah, this isn't in the official version on vim.org yet. That would be a nice thing to update.

@bsans
Copy link

bsans commented Mar 29, 2012

I just wrote issue 38 about this feature, as I was having a problem using this script in MacVim: #38

Fixed it by removing the if-else block around the assignment of the ack script

@kassio
Copy link
Contributor

kassio commented Mar 12, 2014

I use to have this problem too, I change the set switchbuf=useopen,usetab,newtab. This way if the first occurrence is on an existing buffer, vim will move to this buffer, if not vim will open in a newtab.

@kassio kassio closed this as completed Mar 12, 2014
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

4 participants