How to pass nested parameters to fzf in vim?

217 Views Asked by At

How can I make the function Function1 fzf pass var1 to the function Function2?

I know you can do this "function ('s: Function2', [a: var1])", the problem is that it will no longer pass the captured value var2

For now a workaround is with a global variable, but I honestly don't like it at all :(

" Simplified version
let g:var1 = ''

function! s:Function2(var2) 
    echo 'var2: ' . a:var2 . ' --- ' . 'var1: ' . g:var1 
endfunction

function! s:Function1(var1)
    let g:var1=a:var1
    call fzf#run(fzf#wrap({'source': 'ls -a', 'sink':function('s:Function2')}))
endfunction

function FzfFunction()
    call fzf#run( fzf#wrap({'source': 'ls -a', 'sink': function('s:Function1')}) )
endfunction
0

There are 0 best solutions below