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 { return {
{ {
-- highlighting for chezmoi files template files -- highlighting for chezmoi files template files
@ -12,9 +36,7 @@ return {
keys = { keys = {
{ {
"<leader>sz", "<leader>sz",
function() pick_chezmoi,
require("telescope").extensions.chezmoi.find_files()
end,
desc = "Chezmoi", desc = "Chezmoi",
}, },
}, },
@ -47,7 +69,7 @@ return {
optional = true, optional = true,
opts = function(_, opts) opts = function(_, opts)
local projects = { local projects = {
action = "Telescope chezmoi find_files", action = pick_chezmoi,
desc = " Config", desc = " Config",
icon = "", icon = "",
key = "c", key = "c",