Skip to content

Commit f178c8c

Browse files
committed
run nvim tree refresh on neogit status change
1 parent 0a13676 commit f178c8c

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

lua/nvim-tree/lib.lua

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -168,13 +168,18 @@ end
168168
function M.refresh_tree()
169169
if vim.v.exiting ~= vim.NIL then return end
170170

171-
local use_git = config.use_git()
172-
if use_git then git.reload_roots() end
173171
refresh_nodes(M.Tree)
174-
if use_git then vim.schedule(function() refresh_git(M.Tree) end) end
172+
173+
local use_git = config.use_git()
174+
if use_git then
175+
vim.schedule(function()
176+
git.reload_roots()
177+
refresh_git(M.Tree)
178+
end)
179+
end
175180

176181
if vim.g.nvim_tree_lsp_diagnostics == 1 then
177-
diagnostics.update()
182+
vim.schedule(diagnostics.update)
178183
end
179184

180185
if view.win_open() then

plugin/tree.vim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ augroup NvimTree
2121
au WinClosed * lua require'nvim-tree'.on_leave()
2222
endif
2323
au ColorScheme * lua require'nvim-tree'.reset_highlight()
24-
au User FugitiveChanged lua require'nvim-tree'.refresh()
24+
au User FugitiveChanged,NeogitStatusRefreshed lua require'nvim-tree'.refresh()
2525
if get(g:, 'nvim_tree_tab_open') == 1
2626
au TabEnter * lua require'nvim-tree'.tab_change()
2727
endif

0 commit comments

Comments
 (0)