fzf.vim icon indicating copy to clipboard operation
fzf.vim copied to clipboard

fzf#run with sink 'let variable = '

Open abzrg opened this issue 2 years ago • 0 comments

  • [x] I have fzf 0.23.0 or above
  • [x] I have read through https://github.com/junegunn/fzf.vim/blob/master/README.md
  • [x] I have read through https://github.com/junegunn/fzf/blob/master/README-VIM.md
  • [x] I have read through the manual page of fzf (man fzf)
  • [x] I have searched through the existing issues
Neovim v 0.5
fzf v 0.27.2 (8255aa2)

I want to store the selected item into a variable. The error I get is that variable x (the selected item) is not defined. It seems that when the command let var = x is issued, x is not placed there as string. For that, I tried to use the reducer per below, but I couldn't get it right. Note that I am able to select my item, but when it comes to sink, it crashes.

fzf#run({'source' : list, 'sink': 'let var = ', 'reducer': { lines -> '"' . string(lines[0]) . '"' } })

My goal is to simply give it a list and put the selected item into a variable as a string.

abzrg avatar Sep 14 '21 08:09 abzrg