mileszs / ack.vim

Vim plugin for the Perl module / CLI script 'ack'
Other
3.08k stars 396 forks source link

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

Closed AndrewRayCode closed 10 years ago

AndrewRayCode commented 12 years ago

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 commented 12 years ago

Use :Ack! instead of :Ack :)

AndrewRayCode commented 12 years ago

:Ack! word

"No ! allowed"

czak commented 12 years ago

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 commented 12 years ago

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

(I'm probably using an older version)

AndrewRayCode commented 12 years ago

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

bsans commented 12 years ago

I just wrote issue 38 about this feature, as I was having a problem using this script in MacVim: https://github.com/mileszs/ack.vim/issues/38

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

kassio commented 10 years ago

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.