mirror of
https://github.com/LazyVim/LazyVim.git
synced 2025-06-21 16:39:06 +02:00
feat(chezmoi): add snacks picker integration for chezmoi files (#5429)
## Description We have a new picker Snacks picker, it means telescope and fzf-lua can be uninstalled. But chezmoi files still listed only with telescope and fzf-lua. In this pr we add snacks.picker integration if the user has chosen snacks.picker in the LazyVimExtras.
This commit is contained in:
parent
b574f01af7
commit
970d1a05da
1 changed files with 32 additions and 0 deletions
|
@ -19,6 +19,38 @@ local pick_chezmoi = function()
|
|||
},
|
||||
}
|
||||
fzf_lua.fzf_exec(results, opts)
|
||||
elseif LazyVim.pick.picker.name == "snacks" then
|
||||
local results = require("chezmoi.commands").list({
|
||||
args = {
|
||||
"--path-style",
|
||||
"absolute",
|
||||
"--include",
|
||||
"files",
|
||||
"--exclude",
|
||||
"externals",
|
||||
},
|
||||
})
|
||||
local items = {}
|
||||
|
||||
for _, czFile in ipairs(results) do
|
||||
table.insert(items, {
|
||||
text = czFile,
|
||||
file = czFile,
|
||||
})
|
||||
end
|
||||
|
||||
---@type snacks.picker.Config
|
||||
local opts = {
|
||||
items = items,
|
||||
confirm = function(picker, item)
|
||||
picker:close()
|
||||
require("chezmoi.commands").edit({
|
||||
targets = { item.text },
|
||||
args = { "--watch" },
|
||||
})
|
||||
end,
|
||||
}
|
||||
Snacks.picker.pick(opts)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue