fix(util): clear buffer root cache when cwd change

This commit is contained in:
Tangtang Zhou 2024-02-04 16:09:20 +01:00
parent a50f92f755
commit 70bca69246

View file

@ -144,7 +144,7 @@ function M.setup()
Util.root.info()
end, { desc = "LazyVim roots for the current buffer" })
vim.api.nvim_create_autocmd({ "LspAttach", "BufWritePost" }, {
vim.api.nvim_create_autocmd({ "LspAttach", "BufWritePost", "DirChanged" }, {
group = vim.api.nvim_create_augroup("lazyvim_root_cache", { clear = true }),
callback = function(event)
M.cache[event.buf] = nil