Append extra options string in completion functions
This commit is contained in:
parent
3bbcce79ce
commit
b08b8519c6
2 changed files with 19 additions and 4 deletions
|
@ -778,6 +778,11 @@ function! fzf#vim#complete(...)
|
|||
endif
|
||||
let s:opts = s:eval(s:opts, 'source', s:query)
|
||||
let s:opts = s:eval(s:opts, 'options', s:query)
|
||||
let s:opts = s:eval(s:opts, 'extra_options', s:query)
|
||||
if has_key(s:opts, 'extra_options')
|
||||
let s:opts.options =
|
||||
\ join(filter([get(s:opts, 'options', ''), remove(s:opts, 'extra_options')], '!empty(v:val)'))
|
||||
endif
|
||||
|
||||
call feedkeys("\<Plug>(-fzf-complete-trigger)")
|
||||
return ''
|
||||
|
|
|
@ -24,8 +24,18 @@
|
|||
let s:cpo_save = &cpo
|
||||
set cpo&vim
|
||||
|
||||
function! s:extend(base, extra)
|
||||
let base = copy(a:base)
|
||||
if has_key(a:extra, 'options')
|
||||
let extra = copy(a:extra)
|
||||
let extra.extra_options = remove(extra, 'options')
|
||||
return extend(base, extra)
|
||||
endif
|
||||
return extend(base, a:extra)
|
||||
endfunction
|
||||
|
||||
function! fzf#vim#complete#word(...)
|
||||
return fzf#vim#complete(extend({
|
||||
return fzf#vim#complete(s:extend({
|
||||
\ 'source': 'cat /usr/share/dict/words'},
|
||||
\ get(a:000, 0, g:fzf#vim#default_layout)))
|
||||
endfunction
|
||||
|
@ -104,7 +114,7 @@ endfunction
|
|||
|
||||
function! fzf#vim#complete#path(command, ...)
|
||||
let s:file_cmd = a:command
|
||||
return fzf#vim#complete(extend({
|
||||
return fzf#vim#complete(s:extend({
|
||||
\ 'prefix': function('s:fname_prefix'),
|
||||
\ 'source': function('s:file_source'),
|
||||
\ 'options': function('s:file_options')}, get(a:000, 0, g:fzf#vim#default_layout)))
|
||||
|
@ -119,7 +129,7 @@ function! s:reduce_line(lines)
|
|||
endfunction
|
||||
|
||||
function! fzf#vim#complete#line(...)
|
||||
return fzf#vim#complete(extend({
|
||||
return fzf#vim#complete(s:extend({
|
||||
\ 'prefix': '^.*$',
|
||||
\ 'source': fzf#vim#_lines(0),
|
||||
\ 'options': '--tiebreak=index --ansi --nth 3..',
|
||||
|
@ -127,7 +137,7 @@ function! fzf#vim#complete#line(...)
|
|||
endfunction
|
||||
|
||||
function! fzf#vim#complete#buffer_line(...)
|
||||
call fzf#vim#complete(extend({
|
||||
call fzf#vim#complete(s:extend({
|
||||
\ 'prefix': '^.*$',
|
||||
\ 'source': s:uniq(getline(1, '$'))}, get(a:000, 0, g:fzf#vim#default_layout)))
|
||||
endfunction
|
||||
|
|
Loading…
Add table
Reference in a new issue