From 692bd4a00e26381510aad3ae02fcb5b3ae8221f1 Mon Sep 17 00:00:00 2001 From: Thomas Vandal Date: Sun, 29 Dec 2024 21:41:49 -0500 Subject: [PATCH] Update fzf-lua `pick_chezmoi` to use files picker and chezmoiedit command - Use `fzf-lua`'s `files` picker to have icons and preview - Use `vimcd_entry()` to parse picker output --- lua/lazyvim/plugins/extras/util/chezmoi.lua | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/lua/lazyvim/plugins/extras/util/chezmoi.lua b/lua/lazyvim/plugins/extras/util/chezmoi.lua index cffa6749..afaef6e4 100644 --- a/lua/lazyvim/plugins/extras/util/chezmoi.lua +++ b/lua/lazyvim/plugins/extras/util/chezmoi.lua @@ -3,22 +3,12 @@ local pick_chezmoi = function() 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, - }, + local actions = { + ["enter"] = function(selected) + fzf_lua.actions.vimcmd_entry("ChezmoiEdit", selected, {cwd = os.getenv("HOME")}) + end, } - fzf_lua.fzf_exec(results, opts) + require("fzf-lua").files({ cmd = "chezmoi managed --include=files,symlinks", actions = actions }) elseif LazyVim.pick.picker.name == "snacks" then local results = require("chezmoi.commands").list({ args = {