snacks.explorer git status not updating untill session closed
#2509
-
|
When I add new files externally it doesn't update the git status icons on the Also when making commits it keeps showing the git status for newly made files inside the explorer until I close and open it again. Is there some sort of a cache it keeps and if it does how can I stop that cause it's pretty annoying to close and reopen each time. |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 5 replies
-
explorer.mp4nvim -u repro.lua repro.lua
-- repro.lua
vim.env.LAZY_STDPATH = '.repro'
load(vim.fn.system 'curl -s https://raw.githubusercontent.com/folke/lazy.nvim/main/bootstrap.lua')()
require('lazy.minit').repro {
spec = {
{
'folke/snacks.nvim',
lazy = false,
-- stylua: ignore
keys = {
{ '\\', function() Snacks.explorer() end },
},
opts = {
explorer = {},
},
},
},
}
-- vim: ts=2 sw=2 |
Beta Was this translation helpful? Give feedback.
-
|
You can press |
Beta Was this translation helpful? Give feedback.
-
|
I use this worked. https://github.com/zeevenn/dotfiles/blob/main/.config/nvim/lua/plugins/editor.lua#L58-L76 -- Refresh git status when focus returns to Neovim (e.g., after git commit)
vim.api.nvim_create_autocmd("FocusGained", {
group = vim.api.nvim_create_augroup("snacks_explorer_git_refresh", { clear = true }),
callback = function()
local ok, Git = pcall(require, "snacks.explorer.git")
if not ok then
return
end
-- Force refresh git status (clear cache)
for root in pairs(Git.state) do
Git.state[root].last = 0
end
-- Update all open explorers
local explorers = Snacks.picker.get({ source = "explorer" })
for _, explorer in ipairs(explorers) do
require("snacks.explorer.actions").update(explorer, { refresh = true })
end
end,
}) |
Beta Was this translation helpful? Give feedback.
-
|
I try a lot of times, and the following may be resolve the problem. |
Beta Was this translation helpful? Give feedback.
You can press
uto update the explorer.