Skip to content

Commit 023dc23

Browse files
committed
fix: load direnv only when .envrc exists
1 parent 1c7be70 commit 023dc23

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lua/keymap/tool.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ for _, mode in pairs(modes) do
244244
["<A-d>"] = { pos = "float", id = "FloatTerm" },
245245
}) do
246246
mappings.plugins[string.format("%s|%s", mode, key)] = map_callback(function()
247-
if vim.fn.executable("direnv") == 1 then
247+
if vim.fn.executable("direnv") == 1 and vim.loop.fs_stat(vim.uv.cwd() .. "/.envrc") ~= nil then
248248
opts = vim.tbl_extend("force", opts, { cmd = "direnv allow" })
249249
end
250250
require("nvchad.term").toggle(opts)

0 commit comments

Comments
 (0)