Closed Penaz91 closed 1 year ago
Unfortunately, this is just how vim works. When you open fzf, that puts your cursor inside of a terminal window in insert mode (technically, in "terminal" mode). There's no way to also have your cursor be in the original window with a visual mode selection. You could potentially save the current visual selection before calling vim.ui.select
, or you could restore the selection after vim.ui.select
completes with vim.cmd.normal({args = {"gv"}})
, but there's no way to preserve that visual selection while doing anything else with your cursor.
I understand. I thought it was an issue because the normal vim.ui seemed to keep the visual selection "active in background" (although probably only visually) and restore it after the task was completed.
Thank you for the clarification, feel free to close this ticket!
The built-in vim.ui
methods use synchronous input functions that block Neovim. All other rendering is paused while waiting for input()
or inputlist()
. This can be helpful if you really do need the user to input something before you continue execution, but you'll want to manually use vim.fn.inputlist
if that's what you're after, since vim.ui.select
is designed to work async.
Describe the bug While trying to make a quick menu for nvim's LSP, I ran into the following issue: if you select some text and open vim.ui.* using dressing, the visual selection is lost.
System information
vim.ui.select
backend? If so, which one? Tested on vim.ui.select and vim.ui.inputTo Reproduce Steps to reproduce the behavior:
Additional context I tried disabling the plugin and using the native vim.ui.select and the selection is kept.
I'm using the fzf backend with
ibhagwan/fzf-lua
.I'm available for any question!