mileszs / ack.vim

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

Search opens a file in NERDTree window #165

Closed triplepointfive closed 9 years ago

triplepointfive commented 9 years ago

Steps to reproduce:

The first matching search file opens in NERDTree window, that's not really useful since NERDTree window is usually pretty thin.

Expected behaviour is to open a file in an adjacent window.

cdpalmer commented 9 years ago

I think this is expected behavior.

When you open a file in NERDTree, it'll open in the last active window. So when you do search, it will open in the last active window (which in your situation is NERDTree, which is in a window).

I use a lot of splitting of windows and expect the search to open in my active window. With your expected behavior, I wouldn't know where you would expect a file to open from search if there were multiple split windows.

Numkil commented 9 years ago

Just use an ! after the ack command to stop it from overriding the nerdtree window. Then use one of these to open it in the way you want and where you want.

  t    to open in new tab
  T    to open in new tab without moving to it
  h    to open in horizontal split
  H    to open in horizontal split, keeping focus on the results
  v    to open in vertical split
  gv   to open in vertical split, keeping focus on the results

Shouldn't that be flexible enough?

triplepointfive commented 9 years ago

I didn't know of Ack!, that does the trick, thack you @Numkil