From 11725a4590d563a2339f2df72b67122c54152f60 Mon Sep 17 00:00:00 2001 From: Elizer Dolorosa Date: Fri, 24 Oct 2025 10:16:59 +0800 Subject: [PATCH] fix(fzf-lua): set cwd for previewing chezmoi files outside home directory Used the solution posted by @zjrgov in this gist: https://github.com/LazyVim/LazyVim/pull/6095#issuecomment-3258889700 --- lua/lazyvim/plugins/extras/util/chezmoi.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lua/lazyvim/plugins/extras/util/chezmoi.lua b/lua/lazyvim/plugins/extras/util/chezmoi.lua index ff4501db..628fb8bd 100644 --- a/lua/lazyvim/plugins/extras/util/chezmoi.lua +++ b/lua/lazyvim/plugins/extras/util/chezmoi.lua @@ -3,12 +3,13 @@ local pick_chezmoi = function() require("telescope").extensions.chezmoi.find_files() elseif LazyVim.pick.picker.name == "fzf" then local fzf_lua = require("fzf-lua") + local dest_dir = os.getenv("HOME") local actions = { ["enter"] = function(selected) - fzf_lua.actions.vimcmd_entry("ChezmoiEdit", selected, { cwd = os.getenv("HOME") }) + fzf_lua.actions.vimcmd_entry("ChezmoiEdit", selected, { cwd = dest_dir }) end, } - fzf_lua.files({ cmd = "chezmoi managed --include=files,symlinks", actions = actions, hidden = false }) + fzf_lua.files({ cmd = "chezmoi managed --include=files,symlinks", actions = actions, cwd = dest_dir, hidden = false }) elseif LazyVim.pick.picker.name == "snacks" then local results = require("chezmoi.commands").list({ args = {