diff --git a/lua/project_nvim/project.lua b/lua/project_nvim/project.lua index 28fa4b7..6b3a1ab 100644 --- a/lua/project_nvim/project.lua +++ b/lua/project_nvim/project.lua @@ -232,7 +232,7 @@ function M.on_buf_enter() end local current_dir = vim.fn.expand("%:p:h", true) - if path.is_excluded(current_dir) then + if not path.exists(current_dir) or path.is_excluded(current_dir) then return end diff --git a/lua/project_nvim/utils/path.lua b/lua/project_nvim/utils/path.lua index fd06a68..69ac7ad 100644 --- a/lua/project_nvim/utils/path.lua +++ b/lua/project_nvim/utils/path.lua @@ -30,4 +30,8 @@ function M.is_excluded(dir) return false end +function M.exists(path) + return vim.fn.empty(vim.fn.glob(path)) == 0 +end + return M