2016-06-26 07:12:36 -04:00
|
|
|
if exists('g:loaded_ack') || &cp
|
2015-02-24 05:45:22 -05:00
|
|
|
finish
|
|
|
|
endif
|
|
|
|
|
2014-04-18 08:58:02 -04:00
|
|
|
if !exists("g:ack_default_options")
|
2016-05-14 07:57:54 -04:00
|
|
|
let g:ack_default_options = " -s -H --nopager --nocolor --nogroup --column"
|
2014-04-18 08:58:02 -04:00
|
|
|
endif
|
2012-08-16 23:41:25 -04:00
|
|
|
|
|
|
|
" Location of the ack utility
|
|
|
|
if !exists("g:ackprg")
|
2016-05-14 07:57:54 -04:00
|
|
|
if executable('ack-grep')
|
2014-04-18 08:58:02 -04:00
|
|
|
let g:ackprg = "ack-grep"
|
2016-05-14 07:57:54 -04:00
|
|
|
elseif executable('ack')
|
|
|
|
let g:ackprg = "ack"
|
2014-04-18 08:58:02 -04:00
|
|
|
else
|
|
|
|
finish
|
|
|
|
endif
|
|
|
|
let g:ackprg .= g:ack_default_options
|
2013-04-13 13:45:21 -04:00
|
|
|
endif
|
|
|
|
|
|
|
|
if !exists("g:ack_apply_qmappings")
|
|
|
|
let g:ack_apply_qmappings = !exists("g:ack_qhandler")
|
|
|
|
endif
|
|
|
|
|
|
|
|
if !exists("g:ack_apply_lmappings")
|
|
|
|
let g:ack_apply_lmappings = !exists("g:ack_lhandler")
|
|
|
|
endif
|
|
|
|
|
2014-04-18 08:58:02 -04:00
|
|
|
let s:ack_mappings = {
|
|
|
|
\ "t": "<C-W><CR><C-W>T",
|
|
|
|
\ "T": "<C-W><CR><C-W>TgT<C-W>j",
|
|
|
|
\ "o": "<CR>",
|
2014-07-02 07:18:18 -04:00
|
|
|
\ "O": "<CR><C-W>p<C-W>c",
|
|
|
|
\ "go": "<CR><C-W>p",
|
2014-04-18 08:58:02 -04:00
|
|
|
\ "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" }
|
|
|
|
|
|
|
|
if exists("g:ack_mappings")
|
|
|
|
let g:ack_mappings = extend(s:ack_mappings, g:ack_mappings)
|
|
|
|
else
|
|
|
|
let g:ack_mappings = s:ack_mappings
|
|
|
|
endif
|
|
|
|
|
2013-04-13 13:45:21 -04:00
|
|
|
if !exists("g:ack_qhandler")
|
2014-04-18 08:58:02 -04:00
|
|
|
let g:ack_qhandler = "botright copen"
|
2013-04-13 13:45:21 -04:00
|
|
|
endif
|
|
|
|
|
|
|
|
if !exists("g:ack_lhandler")
|
2014-04-18 08:58:02 -04:00
|
|
|
let g:ack_lhandler = "botright lopen"
|
2012-08-16 23:41:25 -04:00
|
|
|
endif
|
|
|
|
|
2014-04-18 08:58:02 -04:00
|
|
|
if !exists("g:ackhighlight")
|
|
|
|
let g:ackhighlight = 0
|
|
|
|
endif
|
2013-04-13 13:45:21 -04:00
|
|
|
|
2014-04-18 08:58:02 -04:00
|
|
|
if !exists("g:ack_autoclose")
|
|
|
|
let g:ack_autoclose = 0
|
|
|
|
endif
|
2013-04-13 13:45:21 -04:00
|
|
|
|
2014-04-18 08:58:02 -04:00
|
|
|
if !exists("g:ack_autofold_results")
|
|
|
|
let g:ack_autofold_results = 0
|
|
|
|
endif
|
2012-08-16 23:41:25 -04:00
|
|
|
|
2016-05-14 07:57:54 -04:00
|
|
|
if !exists("g:ack_use_cword_for_empty_search")
|
|
|
|
let g:ack_use_cword_for_empty_search = 1
|
|
|
|
endif
|
|
|
|
|
2014-04-18 08:58:02 -04:00
|
|
|
command! -bang -nargs=* -complete=file Ack call ack#Ack('grep<bang>', <q-args>)
|
|
|
|
command! -bang -nargs=* -complete=file AckAdd call ack#Ack('grepadd<bang>', <q-args>)
|
|
|
|
command! -bang -nargs=* -complete=file AckFromSearch call ack#AckFromSearch('grep<bang>', <q-args>)
|
|
|
|
command! -bang -nargs=* -complete=file LAck call ack#Ack('lgrep<bang>', <q-args>)
|
|
|
|
command! -bang -nargs=* -complete=file LAckAdd call ack#Ack('lgrepadd<bang>', <q-args>)
|
|
|
|
command! -bang -nargs=* -complete=file AckFile call ack#Ack('grep<bang> -g', <q-args>)
|
|
|
|
command! -bang -nargs=* -complete=help AckHelp call ack#AckHelp('grep<bang>', <q-args>)
|
|
|
|
command! -bang -nargs=* -complete=help LAckHelp call ack#AckHelp('lgrep<bang>', <q-args>)
|
2015-07-13 06:22:46 -04:00
|
|
|
command! -bang -nargs=* AckWindow call ack#AckWindow('grep<bang>', <q-args>)
|
|
|
|
command! -bang -nargs=* LAckWindow call ack#AckWindow('lgrep<bang>', <q-args>)
|
2015-02-24 05:45:22 -05:00
|
|
|
|
|
|
|
let g:loaded_ack = 1
|
|
|
|
|
|
|
|
" vim:set et sw=2 ts=2 tw=78 fdm=marker
|