Closed TroySigX closed 4 months ago
I agree and I'm actually using fzf-lua myself for most pickers, but couldn't find a good example how to populate a picker.
But I would welcome PR's or even links to good docs. Telescope was just the easiest to get started with.
Hmm, I'm not very proficient with lua, but I found this via :h vim.ui.select
:
select({items}, {opts}, {on_choice}) *vim.ui.select()*
Prompts the user to pick from a list of items, allowing arbitrary
(potentially asynchronous) work until `on_choice`.
Example: >lua
vim.ui.select({ 'tabs', 'spaces' }, {
prompt = 'Select tabs or spaces:',
format_item = function(item)
return "I'd like to choose " .. item
end,
}, function(choice)
if choice == 'spaces' then
vim.o.expandtab = true
else
vim.o.expandtab = false
end
end)
<
Parameters: ~
• {items} (table) Arbitrary items
• {opts} (table) Additional options
• prompt (string|nil) Text of the prompt. Defaults to
`Select one of:`
• format_item (function item -> text) Function to format
an individual item from `items`. Defaults to
`tostring`.
• kind (string|nil) Arbitrary hint string indicating the
item shape. Plugins reimplementing `vim.ui.select` may
wish to use this to infer the structure or semantics of
`items`, or the context in which select() was called.
• {on_choice} (function) ((item|nil, idx|nil) -> ()) Called once the
user made a choice. `idx` is the 1-based index of `item`
within `items`. `nil` if the user aborted the dialog.
Would using dressing.nvim solve your problem? It has the telescope
option here
I dont think I will add support for a different viewer. It would not be so hard to do since in the new regexp version, the GUI code is very small and self-contained. But I dont know this area very well and I rather focus on the core plugin.
But if anyone wants to contribute a PR, feel free to do so!
I notice that
venv-selector
only usesTelescope
as its visual picker. It would be great if it migrate to something more general, likevim.ui.select
, that way, users can choose between different pickers likenui.nvim
orfzf-lua
.