look for .envrc before calling direnv

This commit is contained in:
raf 2024-07-03 18:11:46 +03:00
parent 27abc8e721
commit 91558d1edc
Signed by: NotAShelf
GPG key ID: AF26552424E53993

View file

@ -57,7 +57,10 @@ M.setup = function(user_config)
},
}, "n")
if config.autoload_direnv then
-- If user has enabled autoloading, and current directory has an .envrc
-- then load it. This has performance implications as it will check for
-- a filepath on each BufEnter event.
if config.autoload_direnv and vim.fn.glob("**/.envrc") ~= "" then
local group_id = vim.api.nvim_create_augroup("DirenvNvim", {})
vim.api.nvim_create_autocmd({ "BufEnter" }, {
pattern = "*",