mileszs / ack.vim

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

I always return to the leftmost window, not the latest active window when I exit the search results #219

Closed acgtyrant closed 6 years ago

acgtyrant commented 7 years ago

For example, I ack a word in the rightmost window:

2017-06-07-151256_1918x1056_scrot

But if I exit the search results, I will return to the leftmost window!

2017-06-07-151442_1914x1064_scrot

2017-06-07-151504_1921x1058_scrot

It is boring, any idea? Thank you!

ches commented 6 years ago

Yes, this is a known effect of the way we open the quickfix list by default, spanning the bottom of the tabpage. It is nothing particular to ack.vim, you'll see the same behavior if you try something like this:

:vimgrep /something/f *
:botright copen
:q

There are couple of ways you can avoid it:

  1. Use LAck[!] to populate results in the location list instead of quickfix list. This opens the list in a split below your active window only, not across the tabpage. Closing the window will then leave the cursor back where you started.
  2. Change the default value of g:ack_qhandler. See :help g:ack_qhandler—the default is botright copen, if you let g:ack_qhandler = 'copen' then the quickfix list will also be opened as a split of your active window only, like above but with :Ack[!].

Closing as this is just how Vim works, not a problem of ack.vim, and I believe the above suggestions give fair options for workarounds if it bothers you. Sorry that it took so long to respond!