junegunn / junegunn/fzf.vim

fzf#run with sink 'let variable = '

Open
#1,327 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Vim Script
Stars
10.3k
Forks
608
Avg merge
5d 8h
Merged PRs (30d)
2

Description

- [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.

```vim
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.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.