Add script to get variable value & fix one vint warning.
@@ -138,13 +138,14 @@ function! s:FZF(source, sink) abort
return
endif
- if exists('LanguageClient_fzfOptions')
- let l:options = LanguageClient_fzfOptions
- elseif exists('*fzf#vim#with_preview')
+ let l:options = s:GetVar('LanguageClient_fzfOptions')
+ if l:options is v:null
+ if exists('*fzf#vim#with_preview')
let l:options = fzf#vim#with_preview('right:50%:hidden', '?').options
else
let l:options = []
endif
+ endif
call fzf#run(fzf#wrap({
\ 'source': a:source,
\ 'sink': function(a:sink),
@@ -187,6 +188,20 @@ function! s:AddHighlights(source, highlights) abort
endfor
endfunction
+" Get an variable value.
+" First try buffer local, then global, then default, then v:null.
+function! s:GetVar(...) abort
+ let name = a:0
+
+ if exists('b:' . name)
+ return get(b:, name)
+ elseif exists('g:' . name)
+ return get(g:, name)
+ else
+ return get(a:000, 1, v:null)
+ endif
+endfunction
+
let s:id = 1
let s:handlers = {}
