diff --git a/lua/lazyvim/plugins/extras/util/chezmoi.lua b/lua/lazyvim/plugins/extras/util/chezmoi.lua index f16b5889..56518dfd 100644 --- a/lua/lazyvim/plugins/extras/util/chezmoi.lua +++ b/lua/lazyvim/plugins/extras/util/chezmoi.lua @@ -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 = { { "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",