Make fzf#vim#complete#path take command as the first argument

inoremap <expr> <c-x><c-g> fzf#vim#complete#path('git ls-files $(git rev-parse --show-toplevel)')
This commit is contained in:
Junegunn Choi
2015-09-12 02:52:43 +09:00
parent 2a9ac9602b
commit 47fb2c3eb6
2 changed files with 5 additions and 17 deletions

View File

@@ -102,24 +102,12 @@ function! s:fname_prefix(str)
return prefix
endfunction
function! s:complete_file(command, extra_opts)
function! fzf#vim#complete#path(command, ...)
let s:file_cmd = a:command
return fzf#vim#complete(extend({
\ 'prefix': function('s:fname_prefix'),
\ 'source': function('s:file_source'),
\ 'options': function('s:file_options')}, get(a:extra_opts, 0, g:fzf#vim#default_layout)))
endfunction
function! fzf#vim#complete#path(...)
return s:complete_file("find . -path '*/\.*' -prune -o -print \| sed '1d;s:^..::'", a:000)
endfunction
function! fzf#vim#complete#file(...)
return s:complete_file("find . -path '*/\.*' -prune -o -type f -print -o -type l -print \| sed '1d;s:^..::'", a:000)
endfunction
function! fzf#vim#complete#file_ag(...)
return s:complete_file("ag -l -g ''", a:000)
\ 'options': function('s:file_options')}, get(a:000, 0, g:fzf#vim#default_layout)))
endfunction
" ----------------------------------------------------------------------------