mirror of
https://github.com/LazyVim/LazyVim.git
synced 2026-07-25 14:01:06 +00:00
feat(chezmoi): add snacks picker integration for chezmoi files
This commit is contained in:
parent
b574f01af7
commit
03c3089787
1 changed files with 36 additions and 0 deletions
|
|
@ -19,6 +19,42 @@ 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 i, czFile in ipairs(results) do
|
||||
table.insert(items, {
|
||||
idx = i,
|
||||
score = i,
|
||||
text = czFile,
|
||||
name = czFile,
|
||||
file = czFile,
|
||||
})
|
||||
end
|
||||
|
||||
---@type snacks.picker.Config
|
||||
local opts = {
|
||||
items = items,
|
||||
format = "filename",
|
||||
confirm = function(_, item)
|
||||
-- picker:close()
|
||||
require("chezmoi.commands").edit({
|
||||
targets = { item.text },
|
||||
args = { "--watch" },
|
||||
})
|
||||
end,
|
||||
}
|
||||
Snacks.picker.pick(opts)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue