mileszs / ack.vim

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

j/k does not work right with vsplit #238

Closed matejcik closed 6 years ago

matejcik commented 6 years ago

to reproduce:

  1. vsplit your window
  2. :Ack! word, where "word" is something that exists in multiple files in your cwd
  3. attempt to move between search results using j/k, going from one file to another

expected: cursor moves up/down on the result list, and the highlight in the current window follows the selected result

actual: when moving across file boundary, cursor skips to the right vsplit and moves there instead

with g:ackpreview=1 this happens whenever you go from one file to another; without it, it only happens when going from a different file back to the currently open one

probably related to #219 and #66 ?

ches commented 6 years ago

I see what you mean in the case of g:ackpreview=1—I don't use that feature, but it was doing something clearly wrong. Can you try updating the plugin now?

I'm afraid I can't reproduce what you describe when g:ackpreview=0, we don't remap j and k at all in that case so there should be no way that the cursor focus jumps out of the results buffer.

If you still have a problem in either case after updating, let me know, maybe I need another explanation of how to reproduce.

matejcik commented 6 years ago

I think I see the problem...

This commit does fix all issues I was experiencing (so thanks, and wow that was fast!). However, actually setting g:ackpreview=0 does not disable preview! Because your code is checking for exists(ackpreview), which is true even with zero value. So either the check is wrong, or the documentation is misleading (stating that default is 0, when default is unset).

(I'm not sure why I saw different behavior. Probably I was confused and not reproducing my own steps correctly.)