From 662418b0b90d6e88ae049566ce0913039b172528 Mon Sep 17 00:00:00 2001 From: Maximilian Friedersdorff Date: Wed, 1 Oct 2025 09:12:55 +0100 Subject: [PATCH] Add chezmoi.vim --- .../nvim/lua/custom/plugins/chezmoi.lua | 64 +++++++++++-------- 1 file changed, 37 insertions(+), 27 deletions(-) diff --git a/home/dot_config/nvim/lua/custom/plugins/chezmoi.lua b/home/dot_config/nvim/lua/custom/plugins/chezmoi.lua index 076be45..ba8cf56 100644 --- a/home/dot_config/nvim/lua/custom/plugins/chezmoi.lua +++ b/home/dot_config/nvim/lua/custom/plugins/chezmoi.lua @@ -3,35 +3,45 @@ local pick_chezmoi = function() end return { - "xvzc/chezmoi.nvim", - dependencies = { "nvim-lua/plenary.nvim" }, - keys = { - { - "sz", - pick_chezmoi, - desc = "Chezmoi", - }, + { + -- highlighting for chezmoi files template files + "alker0/chezmoi.vim", + init = function() + vim.g["chezmoi#use_tmp_buffer"] = 1 + vim.g["chezmoi#source_dir_path"] = os.getenv("HOME") .. "/.local/share/chezmoi" + end, }, - opts = { - edit = { - watch = false, - force = false, + { + "xvzc/chezmoi.nvim", + dependencies = { "nvim-lua/plenary.nvim" }, + keys = { + { + "sz", + pick_chezmoi, + desc = "Chezmoi", + }, }, - notification = { - on_open = true, - on_apply = true, - on_watch = false, - }, - telescope = { - select = { "" }, + opts = { + edit = { + watch = false, + force = false, + }, + notification = { + on_open = true, + on_apply = true, + on_watch = false, + }, + telescope = { + select = { "" }, + }, }, + init = function() + vim.api.nvim_create_autocmd({ "BufRead", "BufNewFile" }, { + pattern = { os.getenv("HOME") .. "/.local/share/chezmoi/*" }, + callback = function() + vim.schedule(require("chezmoi.commands.__edit").watch) + end, + }) + end, }, - init = function() - vim.api.nvim_create_autocmd({ "BufRead", "BufNewFile" }, { - pattern = { os.getenv("HOME") .. "/.local/share/chezmoi/*" }, - callback = function() - vim.schedule(require("chezmoi.commands.__edit").watch) - end, - }) - end, }