From 50f07087e9cd03e2258533a82fc619bc1488165e Mon Sep 17 00:00:00 2001 From: Thomas Vandal Date: Sun, 16 Nov 2025 14:05:55 -0500 Subject: [PATCH 1/3] Use new built-in picker interface for chezmoi.nvim --- lua/lazyvim/plugins/extras/util/chezmoi.lua | 53 +-------------------- 1 file changed, 1 insertion(+), 52 deletions(-) diff --git a/lua/lazyvim/plugins/extras/util/chezmoi.lua b/lua/lazyvim/plugins/extras/util/chezmoi.lua index 201288a4..cb6bcb6c 100644 --- a/lua/lazyvim/plugins/extras/util/chezmoi.lua +++ b/lua/lazyvim/plugins/extras/util/chezmoi.lua @@ -1,54 +1,3 @@ -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 actions = { - ["enter"] = function(selected) - fzf_lua.actions.vimcmd_entry("ChezmoiEdit", selected, { cwd = vim.env.HOME }) - end, - } - fzf_lua.files({ - cmd = "chezmoi managed --include=files,symlinks", - actions = actions, - cwd = vim.env.HOME, - hidden = false, - }) - elseif LazyVim.pick.picker.name == "snacks" then - local results = require("chezmoi.commands").list({ - args = { - "--path-style", - "absolute", - "--include", - "files", - "--exclude", - "externals", - }, - }) - local items = {} - - for _, czFile in ipairs(results) do - table.insert(items, { - text = czFile, - file = czFile, - }) - end - - ---@type snacks.picker.Config - local opts = { - items = items, - confirm = function(picker, item) - picker:close() - require("chezmoi.commands").edit({ - targets = { item.text }, - args = { "--watch" }, - }) - end, - } - Snacks.picker.pick(opts) - end -end - return { { -- highlighting for chezmoi files template files @@ -64,7 +13,7 @@ return { keys = { { "sz", - pick_chezmoi, + function() require("chezmoi.pick")[LazyVim.pick.picker.name]() end , desc = "Chezmoi", }, }, From bab12034b43cce64f432f9b94b1c681064aee8c6 Mon Sep 17 00:00:00 2001 From: Thomas Vandal Date: Sun, 16 Nov 2025 14:07:20 -0500 Subject: [PATCH 2/3] Add `sZ` mapping to search only nvim config files with chezmoi --- lua/lazyvim/plugins/extras/util/chezmoi.lua | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lua/lazyvim/plugins/extras/util/chezmoi.lua b/lua/lazyvim/plugins/extras/util/chezmoi.lua index cb6bcb6c..5f3c3ff9 100644 --- a/lua/lazyvim/plugins/extras/util/chezmoi.lua +++ b/lua/lazyvim/plugins/extras/util/chezmoi.lua @@ -16,6 +16,11 @@ return { function() require("chezmoi.pick")[LazyVim.pick.picker.name]() end , desc = "Chezmoi", }, + { + "sZ", + function() require("chezmoi.pick")[LazyVim.pick.picker.name](vim.fn.stdpath("config")) end , + desc = "Chezmoi", + }, }, opts = { edit = { From 3e997661b8d3638033ece23040e5e02316463a65 Mon Sep 17 00:00:00 2001 From: Thomas Vandal Date: Sun, 16 Nov 2025 14:11:33 -0500 Subject: [PATCH 3/3] Update dashboard pickers and format --- lua/lazyvim/plugins/extras/util/chezmoi.lua | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/lua/lazyvim/plugins/extras/util/chezmoi.lua b/lua/lazyvim/plugins/extras/util/chezmoi.lua index 5f3c3ff9..0c119462 100644 --- a/lua/lazyvim/plugins/extras/util/chezmoi.lua +++ b/lua/lazyvim/plugins/extras/util/chezmoi.lua @@ -13,12 +13,16 @@ return { keys = { { "sz", - function() require("chezmoi.pick")[LazyVim.pick.picker.name]() end , + function() + require("chezmoi.pick")[LazyVim.pick.picker.name]() + end, desc = "Chezmoi", }, { "sZ", - function() require("chezmoi.pick")[LazyVim.pick.picker.name](vim.fn.stdpath("config")) end , + function() + require("chezmoi.pick")[LazyVim.pick.picker.name](vim.fn.stdpath("config")) + end, desc = "Chezmoi", }, }, @@ -51,7 +55,9 @@ return { optional = true, opts = function(_, opts) local projects = { - action = pick_chezmoi, + action = function() + require("chezmoi.pick")[LazyVim.pick.picker.name]() + end, desc = " Config", icon = "", key = "c", @@ -78,7 +84,9 @@ return { icon = " ", key = "c", desc = "Config", - action = pick_chezmoi, + action = function() + require("chezmoi.pick")[LazyVim.pick.picker.name]() + end, } local config_index for i = #opts.dashboard.preset.keys, 1, -1 do