mirror of
https://github.com/LazyVim/LazyVim.git
synced 2026-07-22 12:31:07 +00:00
fix(chezmoi): handle .chezmoiroot in source_dir_path
Add support for .chezmoiroot to configure source directory.## Problem When users have a .chezmoiroot file in their chezmoi source directory, the current chezmoi#source_dir_path setting doesn't include the root subdirectory. This causes chezmoi.vim's filetype detection to fail for files in .chezmoiscripts/ and other special directories. For example, with .chezmoiroot containing home: - Current: ~/.local/share/chezmoi - Expected: ~/.local/share/chezmoi/home ## Solution Read .chezmoiroot file if it exists and append its content to the source path, matching chezmoi.vim's built-in detection behavior. ## Testing Verified with: - .chezmoiscripts/run_once_before_*.sh.tmpl → sh.chezmoitmpl - dot_config/fish/config.fish.tmpl → fish.chezmoitmpl
This commit is contained in:
parent
c64a61734f
commit
5045add053
1 changed files with 12 additions and 1 deletions
|
|
@ -55,7 +55,18 @@ return {
|
|||
"alker0/chezmoi.vim",
|
||||
init = function()
|
||||
vim.g["chezmoi#use_tmp_buffer"] = 1
|
||||
vim.g["chezmoi#source_dir_path"] = vim.env.HOME .. "/.local/share/chezmoi"
|
||||
-- Handle .chezmoiroot for users who organize source files in subdirectories
|
||||
local source = vim.env.HOME .. "/.local/share/chezmoi"
|
||||
local root_file = source .. "/.chezmoiroot"
|
||||
local f = io.open(root_file, "r")
|
||||
if f then
|
||||
local root = f:read("*l")
|
||||
f:close()
|
||||
if root and root ~= "" then
|
||||
source = source .. "/" .. vim.trim(root)
|
||||
end
|
||||
end
|
||||
vim.g["chezmoi#source_dir_path"] = source
|
||||
end,
|
||||
},
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue