Closed Jasha10 closed 9 months ago
After using the minimal setup using vim -Nu <(curl https://gist.githubusercontent.com/junegunn/6936bf79fedd3a079aeb1dd2f3c81ef5/raw)
I realized that fzf#run
already returns the selected line(s). I must have a problem somewhere in my .vimrc that's making fzf#run
not return the selected lines.
Ok I'm reopening because :echo fzf#run()
works with the minimal vim setup but it doesn't work with a minimal Neovim setup!
Steps to reproduce:
$ nvim --version
NVIM v0.9.1
...
nvim -Nu <(curl https://gist.githubusercontent.com/junegunn/6936bf79fedd3a079aeb1dd2f3c81ef5/raw)
:echo fzf#run()
. Nothing is echo'd.See https://github.com/junegunn/fzf/issues/2916#issuecomment-1210098626
fzf#run
returning values on regular Vim is a happy coincidence, and you shouldn't rely on this behavior because it's not guaranteed if you open fzf in different layouts. And there's no way to implement blocking fzf#run
on Neovim unless you set up fzf to open using fzf-tmux. It's a shame we don't have better options.
Thanks for your reply, @junegunn. If my understanding is correct, the fundamental issue is that vim/neovim have a single-threaded event loop. This makes it difficult to escape from the callback paradigm without using green threads.
Thanks also for the tip about fzf-tmux. I'll give that a try.
Hello,
I would like to request a blocking version of
fzf#run(...)
that returns the line or list of lines selected.EDIT: This issue only applies to neovim, not to vim. See comment below.
Motivation
Sometimes using a callback via
fzf#run({..., 'sink': MyCallback})
is a pain. It forces me to use an asynchronous programming model.I want a blocking version of
fzf#run
such that I can do:let foo = fzf#run_blocking(...)
. This will enable me to use a functional programming style in my vimscript. Even echoing the line selected by fzf (:echo fzf#run_blocking(...)
) seems very difficult to achieve withfzf#run
.Please let me know if I'm missing something. Related issue: https://github.com/junegunn/fzf/issues/2056
man fzf
)