mirror of
https://github.com/junegunn/fzf.vim.git
synced 2026-02-07 18:31:08 +08:00
@@ -525,16 +525,21 @@ endfunction
|
|||||||
|
|
||||||
" query, [[ag options], options]
|
" query, [[ag options], options]
|
||||||
function! fzf#vim#ag(query, ...)
|
function! fzf#vim#ag(query, ...)
|
||||||
|
let query = escape(empty(a:query) ? '^(?=.)' : a:query, '"\-')
|
||||||
let args = copy(a:000)
|
let args = copy(a:000)
|
||||||
let ag_opts = len(args) > 1 ? remove(args, 0) : ''
|
let ag_opts = len(args) > 1 ? remove(args, 0) : ''
|
||||||
|
let command = printf('%s "%s"', ag_opts, query)
|
||||||
|
return call('fzf#vim#ag_raw', insert(args, command, 0))
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" ag command suffix, [options]
|
||||||
|
function! fzf#vim#ag_raw(command_suffix, ...)
|
||||||
return s:fzf(fzf#vim#wrap({
|
return s:fzf(fzf#vim#wrap({
|
||||||
\ 'source': printf('ag --nogroup --column --color %s "%s"',
|
\ 'source': 'ag --nogroup --column --color '.a:command_suffix,
|
||||||
\ ag_opts,
|
|
||||||
\ escape(empty(a:query) ? '^(?=.)' : a:query, '"\-')),
|
|
||||||
\ 'sink*': s:function('s:ag_handler'),
|
\ 'sink*': s:function('s:ag_handler'),
|
||||||
\ 'options': '--ansi --delimiter : --nth 4..,.. --prompt "Ag> " '.
|
\ 'options': '--ansi --delimiter : --nth 4..,.. --prompt "Ag> " '.
|
||||||
\ '--multi --bind alt-a:select-all,alt-d:deselect-all '.
|
\ '--multi --bind alt-a:select-all,alt-d:deselect-all '.
|
||||||
\ '--color hl:68,hl+:110'}), args)
|
\ '--color hl:68,hl+:110'}), a:000)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" ------------------------------------------------------------------
|
" ------------------------------------------------------------------
|
||||||
|
|||||||
Reference in New Issue
Block a user