mileszs / ack.vim

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

H Key doesn't work as expected #237

Open FR4N7Z opened 6 years ago

FR4N7Z commented 6 years ago

When pressing h key in the quickfix, it opens a new frame instead of moving the cursor to the left.

mboughaba commented 6 years ago

Hi @FR4N7Z

According to the help

====  ack.vim quick help ===============

  *?:*  a quick summary of these keys, repeat to close
  *o:*  to open (same as Enter)
  *O:*  to open and close the quickfix window
 *go:*  to preview file, open but maintain focus on ack.vim results
  *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
  *q:*  to close the quickfix window

========================================

With cursor on the quick fix .

:map h?
*@<C-W><CR><C-W>K " opens in horizontal split

This means it is expected behavior.

However if you want to change the behavior you might want to change g:ack_mappings:

g:ack_mappings
Default: {
      \ "t": "<C-W><CR><C-W>T",
      \ "T": "<C-W><CR><C-W>TgT<C-W>j",
      \ "o": "<CR>",
      \ "O": "<CR><C-W><C-W>:ccl<CR>",
      \ "go": "<CR><C-W>j",
      \ "h": "<C-W><CR><C-W>K",
      \ "H": "<C-W><CR><C-W>K<C-W>b",
      \ "v": "<C-W><CR><C-W>H<C-W>b<C-W>J<C-W>t",
      \ "gv": "<C-W><CR><C-W>H<C-W>b<C-W>J" }

Something like this will work: (not tested)

let g:ack_mappings = { 
      \ "t": "<C-W><CR><C-W>T",
      \ "T": "<C-W><CR><C-W>TgT<C-W>j",
      \ "o": "<CR>",
      \ "O": "<CR><C-W><C-W>:ccl<CR>",
      \ "go": "<CR><C-W>j",
      \ "hh": "<C-W><CR><C-W>K",
      \ "HH": "<C-W><CR><C-W>K<C-W>b",
      \ "v": "<C-W><CR><C-W>H<C-W>b<C-W>J<C-W>t",
      \ "gv": "<C-W><CR><C-W>H<C-W>b<C-W>J" }