mirror of
https://github.com/LazyVim/LazyVim.git
synced 2026-03-10 09:27:25 +00: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 fzf_lua = require("fzf-lua")
|
||||||
local actions = {
|
local actions = {
|
||||||
["enter"] = function(selected)
|
["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,
|
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
|
elseif LazyVim.pick.picker.name == "snacks" then
|
||||||
local results = require("chezmoi.commands").list({
|
local results = require("chezmoi.commands").list({
|
||||||
args = {
|
args = {
|
||||||
@@ -50,7 +55,7 @@ return {
|
|||||||
"alker0/chezmoi.vim",
|
"alker0/chezmoi.vim",
|
||||||
init = function()
|
init = function()
|
||||||
vim.g["chezmoi#use_tmp_buffer"] = 1
|
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,
|
end,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -80,7 +85,7 @@ return {
|
|||||||
init = function()
|
init = function()
|
||||||
-- run chezmoi edit on file enter
|
-- run chezmoi edit on file enter
|
||||||
vim.api.nvim_create_autocmd({ "BufRead", "BufNewFile" }, {
|
vim.api.nvim_create_autocmd({ "BufRead", "BufNewFile" }, {
|
||||||
pattern = { os.getenv("HOME") .. "/.local/share/chezmoi/*" },
|
pattern = { vim.env.HOME .. "/.local/share/chezmoi/*" },
|
||||||
callback = function()
|
callback = function()
|
||||||
vim.schedule(require("chezmoi.commands.__edit").watch)
|
vim.schedule(require("chezmoi.commands.__edit").watch)
|
||||||
end,
|
end,
|
||||||
|
|||||||
Reference in New Issue
Block a user