Skip to content

Commit c1ba93d

Browse files
Add auto-preview feature
Auto-preview files when they are selected in the quickfix window. Include `let g:ackpreview=1` in your .vimrc to enable.
1 parent f183a34 commit c1ba93d

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

plugin/ack.vim

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,12 @@ function! s:Ack(cmd, args)
7676
exec "nnoremap <silent> <buffer> H <C-W><CR><C-W>K<C-W>b"
7777
exec "nnoremap <silent> <buffer> v <C-W><CR><C-W>H<C-W>b<C-W>J<C-W>t"
7878
exec "nnoremap <silent> <buffer> gv <C-W><CR><C-W>H<C-W>b<C-W>J"
79+
80+
" If auto preview in on, remap j and k keys
81+
if exists("g:ackpreview")
82+
exec "nnoremap <silent> <buffer> j j<CR><C-W><C-W>"
83+
exec "nnoremap <silent> <buffer> k k<CR><C-W><C-W>"
84+
endif
7985
endif
8086

8187
" If highlighting is on, highlight the search keyword.

0 commit comments

Comments
 (0)