mirror of
https://github.com/LazyVim/LazyVim.git
synced 2025-06-26 18:59:00 +02:00
feat(pick): move pickers to extras telescope & fzf-lua and include telescope by default
This commit is contained in:
parent
4b9e4edbb1
commit
b2b6ff0738
7 changed files with 309 additions and 266 deletions
|
@ -12,14 +12,43 @@ local M = setmetatable({}, {
|
|||
---@field buf? number
|
||||
---@field show_untracked? boolean
|
||||
|
||||
---@class LazyPicker
|
||||
---@field name string
|
||||
---@field open fun(command:string, opts?:lazyvim.util.pick.Opts)
|
||||
---@field commands table<string, string>
|
||||
|
||||
---@type LazyPicker?
|
||||
M.picker = nil
|
||||
|
||||
---@type table<string, string>
|
||||
M.commands = {
|
||||
files = "find_files",
|
||||
}
|
||||
|
||||
---@param picker LazyPicker
|
||||
function M.register(picker)
|
||||
-- this only happens when using :LazyExtras
|
||||
-- so allow to get the full spec
|
||||
if vim.v.vim_did_enter == 1 then
|
||||
return true
|
||||
end
|
||||
if M.picker then
|
||||
LazyVim.warn(
|
||||
"`LazyVim.pick`: picker already set to `" .. M.picker.name .. "`,\nignoring new picker `" .. picker.name .. "`"
|
||||
)
|
||||
return false
|
||||
end
|
||||
M.picker = picker
|
||||
return true
|
||||
end
|
||||
|
||||
---@param command? string
|
||||
---@param opts? lazyvim.util.pick.Opts
|
||||
function M.open(command, opts)
|
||||
if not M.picker then
|
||||
return LazyVim.error("LazyVim.pick: picker not set")
|
||||
end
|
||||
|
||||
command = command or "auto"
|
||||
opts = opts or {}
|
||||
|
||||
|
@ -46,8 +75,8 @@ function M.open(command, opts)
|
|||
opts.show_untracked = opts.show_untracked ~= false
|
||||
end
|
||||
end
|
||||
command = M.commands[command] or command
|
||||
M._open(command, opts)
|
||||
command = M.picker.commands[command] or command
|
||||
M.picker.open(command, opts)
|
||||
end
|
||||
|
||||
---@param command? string
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue