Add snacks.picker to Pick function
This commit is contained in:
+12
-1
@@ -1721,10 +1721,17 @@ function M.pick(cmd, provider, options)
|
|||||||
-- (defaults to fzf-lua if available, else telescope)
|
-- (defaults to fzf-lua if available, else telescope)
|
||||||
-- Will use vim.g.lazyvim_picker if defined
|
-- Will use vim.g.lazyvim_picker if defined
|
||||||
if provider == nil then
|
if provider == nil then
|
||||||
|
if vim.g.use_snacks_picker == true then
|
||||||
|
provider = 'snacks'
|
||||||
|
else
|
||||||
if vim.g.lazyvim_picker == 'fzf' then
|
if vim.g.lazyvim_picker == 'fzf' then
|
||||||
provider = 'fzf-lua'
|
provider = 'fzf-lua'
|
||||||
elseif vim.g.lazyvim_picker == 'telescope' then
|
elseif vim.g.lazyvim_picker == 'telescope' then
|
||||||
provider = 'telescope'
|
provider = 'telescope'
|
||||||
|
elseif vim.g.lazyvim_picker == 'snacks' then
|
||||||
|
provider = 'snacks'
|
||||||
|
elseif vim.g.lazyvim_picker == 'auto' then
|
||||||
|
provider = LazyVim.pick.want()
|
||||||
else
|
else
|
||||||
local has_fzf, _ = pcall(require, 'fzf-lua')
|
local has_fzf, _ = pcall(require, 'fzf-lua')
|
||||||
if has_fzf then
|
if has_fzf then
|
||||||
@@ -1734,6 +1741,7 @@ function M.pick(cmd, provider, options)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
-- ━━━━━━━━━━━━━━━━━━━━━━━ Handle special commands ━━━━━━━━━━━━━━━━━━━━━━━
|
-- ━━━━━━━━━━━━━━━━━━━━━━━ Handle special commands ━━━━━━━━━━━━━━━━━━━━━━━
|
||||||
|
|
||||||
@@ -1765,9 +1773,10 @@ function M.pick(cmd, provider, options)
|
|||||||
telescope.extensions.egrepify.egrepify({})
|
telescope.extensions.egrepify.egrepify({})
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
end
|
elseif provider == 'fzf' or provider == 'fzf-lua' then
|
||||||
cmd = 'live_grep'
|
cmd = 'live_grep'
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
-- Ensure options is always a table (to avoid errors if nil is passed)
|
-- Ensure options is always a table (to avoid errors if nil is passed)
|
||||||
options = options or {}
|
options = options or {}
|
||||||
@@ -1780,6 +1789,8 @@ function M.pick(cmd, provider, options)
|
|||||||
for _, current_provider in ipairs(providers) do
|
for _, current_provider in ipairs(providers) do
|
||||||
if current_provider == 'telescope' then
|
if current_provider == 'telescope' then
|
||||||
current_provider = 'telescope.builtin'
|
current_provider = 'telescope.builtin'
|
||||||
|
elseif current_provider == 'snacks' then
|
||||||
|
current_provider = 'snacks.picker'
|
||||||
end
|
end
|
||||||
|
|
||||||
if has_picker(current_provider, cmd) then
|
if has_picker(current_provider, cmd) then
|
||||||
|
|||||||
Reference in New Issue
Block a user