fix: missing support for fzf-lua file picker

This commit is contained in:
Jørgen Jensen 2024-07-02 20:23:37 +02:00
parent 78cf6ee024
commit 9794a80ed8
No known key found for this signature in database
GPG key ID: DFAC318EE59F7789

View file

@ -1,3 +1,27 @@
local pick_chezmoi = function()
if LazyVim.pick.picker.name == "telescope" then
require("telescope").extensions.chezmoi.find_files()
elseif LazyVim.pick.picker.name == "fzf" then
local fzf_lua = require("fzf-lua")
local results = require("chezmoi.commands").list()
local chezmoi = require("chezmoi.commands")
local opts = {
fzf_opts = {},
fzf_colors = true,
actions = {
["default"] = function(selected)
chezmoi.edit({
targets = { "~/" .. selected[1] },
args = { "--watch" },
})
end,
},
}
fzf_lua.fzf_exec(results, opts)
end
end
return {
{
-- highlighting for chezmoi files template files
@ -12,9 +36,7 @@ return {
keys = {
{
"<leader>sz",
function()
require("telescope").extensions.chezmoi.find_files()
end,
pick_chezmoi,
desc = "Chezmoi",
},
},
@ -47,7 +69,7 @@ return {
optional = true,
opts = function(_, opts)
local projects = {
action = "Telescope chezmoi find_files",
action = pick_chezmoi,
desc = " Config",
icon = "",
key = "c",