mirror of
https://github.com/amix/vimrc
synced 2025-06-30 11:54:59 +08:00
Updated plugins
This commit is contained in:
@ -26,9 +26,23 @@ function! ack#Ack(cmd, args) "{{{
|
||||
let l:grepformat = '%f'
|
||||
endif
|
||||
|
||||
" Check user policy for blank searches
|
||||
if empty(a:args)
|
||||
if !g:ack_use_cword_for_empty_search
|
||||
echo "No regular expression found."
|
||||
return
|
||||
endif
|
||||
endif
|
||||
|
||||
" If no pattern is provided, search for the word under the cursor
|
||||
let l:grepargs = empty(a:args) ? expand("<cword>") : a:args . join(a:000, ' ')
|
||||
|
||||
"Bypass search if cursor is on blank string
|
||||
if l:grepargs == ""
|
||||
echo "No regular expression found."
|
||||
return
|
||||
endif
|
||||
|
||||
" NOTE: we escape special chars, but not everything using shellescape to
|
||||
" allow for passing arguments etc
|
||||
let l:escaped_args = escape(l:grepargs, '|#%')
|
||||
|
@ -230,6 +230,22 @@ Example:
|
||||
let g:ack_use_dispatch = 1
|
||||
<
|
||||
|
||||
*g:ack_use_cword_for_empty_search*
|
||||
|
||||
g:ack_use_cword_for_empty_search
|
||||
Default: 1
|
||||
|
||||
Use this option to enable blank searches to run against the word under the
|
||||
cursor. When this option is not set, blank searches will only output an error
|
||||
message.
|
||||
|
||||
|
||||
Example:
|
||||
>
|
||||
let g:ack_use_cword_for_empty_search = 0
|
||||
<
|
||||
|
||||
|
||||
==============================================================================
|
||||
MAPPINGS *ack-mappings*
|
||||
|
||||
|
@ -3,15 +3,15 @@ if exists('g:loaded_ack')
|
||||
endif
|
||||
|
||||
if !exists("g:ack_default_options")
|
||||
let g:ack_default_options = " -s -H --nocolor --nogroup --column"
|
||||
let g:ack_default_options = " -s -H --nopager --nocolor --nogroup --column"
|
||||
endif
|
||||
|
||||
" Location of the ack utility
|
||||
if !exists("g:ackprg")
|
||||
if executable('ack')
|
||||
let g:ackprg = "ack"
|
||||
elseif executable('ack-grep')
|
||||
if executable('ack-grep')
|
||||
let g:ackprg = "ack-grep"
|
||||
elseif executable('ack')
|
||||
let g:ackprg = "ack"
|
||||
else
|
||||
finish
|
||||
endif
|
||||
@ -63,6 +63,10 @@ if !exists("g:ack_autofold_results")
|
||||
let g:ack_autofold_results = 0
|
||||
endif
|
||||
|
||||
if !exists("g:ack_use_cword_for_empty_search")
|
||||
let g:ack_use_cword_for_empty_search = 1
|
||||
endif
|
||||
|
||||
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>)
|
||||
|
Reference in New Issue
Block a user