From 57a8fcdf299b26765ca0271f2157baa2f569310a Mon Sep 17 00:00:00 2001 From: Jordi Lambrechts Date: Thu, 17 Apr 2025 08:32:06 +0200 Subject: [PATCH] fix: check if status.state.foundRC equals vim.NIL When opening nvim in a directory that does not contain a .envrc file, this would throw an error on startup. This is because `vim.json.decode` translates the json null to `vim.NIL`, which does not match Lua's `nil` --- lua/direnv.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/direnv.lua b/lua/direnv.lua index 4d32d90..1198b7a 100644 --- a/lua/direnv.lua +++ b/lua/direnv.lua @@ -142,7 +142,7 @@ M._get_rc_status = function(callback) return callback(nil, nil) end - if status.state.foundRC == nil then + if status.state.foundRC == vim.NIL then cache.status = nil cache.path = nil cache.last_check = now