Files
nvimdots/lua/functions/telescope-pickers.lua
2026-06-30 15:54:23 +02:00

31 lines
600 B
Lua

local M = {}
local builtin = require "telescope.builtin"
local state = require "telescope.state"
function M.resume_or_start(picker_name, picker_func, opts)
return function()
opts = opts or {}
local cached_pickers = state.get_global_key "cached_pickers" or {}
local picker_index = nil
for i, cached_picker in ipairs(cached_pickers) do
if
cached_picker.prompt_title == (opts.prompt_title or picker_name)
then
picker_index = i
break
end
end
if picker_index then
builtin.resume { cache_index = picker_index }
else
picker_func(opts)
end
end
end
return M