mirror of
https://github.com/LazyVim/LazyVim.git
synced 2025-12-25 12:14:19 +01:00
fix(chezmoi): use vim.env.HOME instead of os.getenv("HOME") for Windows compatibility
vim.env.HOME works correctly on Windows where the HOME environment variable may not be set, while os.getenv("HOME") returns nil in such cases.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -5,10 +5,15 @@ local pick_chezmoi = function()
|
||||
local fzf_lua = require("fzf-lua")
|
||||
local actions = {
|
||||
["enter"] = function(selected)
|
||||
fzf_lua.actions.vimcmd_entry("ChezmoiEdit", selected, { cwd = os.getenv("HOME") })
|
||||
fzf_lua.actions.vimcmd_entry("ChezmoiEdit", selected, { cwd = vim.env.HOME })
|
||||
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 = vim.env.HOME,
|
||||
hidden = false,
|
||||
})
|
||||
elseif LazyVim.pick.picker.name == "snacks" then
|
||||
local results = require("chezmoi.commands").list({
|
||||
args = {
|
||||
@@ -50,7 +55,7 @@ return {
|
||||
"alker0/chezmoi.vim",
|
||||
init = function()
|
||||
vim.g["chezmoi#use_tmp_buffer"] = 1
|
||||
vim.g["chezmoi#source_dir_path"] = os.getenv("HOME") .. "/.local/share/chezmoi"
|
||||
vim.g["chezmoi#source_dir_path"] = vim.env.HOME .. "/.local/share/chezmoi"
|
||||
end,
|
||||
},
|
||||
{
|
||||
@@ -80,7 +85,7 @@ return {
|
||||
init = function()
|
||||
-- run chezmoi edit on file enter
|
||||
vim.api.nvim_create_autocmd({ "BufRead", "BufNewFile" }, {
|
||||
pattern = { os.getenv("HOME") .. "/.local/share/chezmoi/*" },
|
||||
pattern = { vim.env.HOME .. "/.local/share/chezmoi/*" },
|
||||
callback = function()
|
||||
vim.schedule(require("chezmoi.commands.__edit").watch)
|
||||
end,
|
||||
|
||||
Reference in New Issue
Block a user