1
0
Fork 0
mirror of https://github.com/pnx/dotfiles synced 2026-06-16 03:14:55 +02:00

nvim/lua/user: lazy-load telescope ui-select extension

This commit is contained in:
Henrik Hautakoski 2026-05-20 22:51:55 +02:00
parent 76aac6c990
commit 2bf2124142
2 changed files with 33 additions and 3 deletions

View file

@ -204,4 +204,26 @@ function M.height(percentage, opts)
end
end
local select_loader_loaded = false
-- Neat hack to lazy load ui-select extension when vim.ui.select() is called.
function M.register_ui_select_loader()
if select_loader_loaded then
return
end
local std_select = vim.ui.select
vim.ui.select = function (items, opts, choice)
local hasExt, _ = pcall(require, "telescope._extensions.ui-select")
if hasExt then
require('telescope').load_extension("ui-select")
else
vim.ui.select = std_select
end
vim.ui.select(items, opts, choice)
end
select_loader_loaded = true
end
return M