Skip to content

Commit 9aed1ac

Browse files
authored
fix: Gitignore rules not being applied on new nodes. (#415)
1 parent 3a5b7c8 commit 9aed1ac

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

lua/nvim-tree/config.lua

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,12 @@ function M.get_icon_state()
6464
}
6565
end
6666

67+
function M.use_git()
68+
return M.get_icon_state().show_git_icon
69+
or vim.g.nvim_tree_git_hl == 1
70+
or vim.g.nvim_tree_gitignore == 1
71+
end
72+
6773
function M.nvim_tree_callback(callback_name)
6874
return string.format(":lua require'nvim-tree'.on_keypress('%s')<CR>", callback_name)
6975
end

lua/nvim-tree/lib.lua

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -152,12 +152,10 @@ end
152152
function M.refresh_tree()
153153
if vim.v.exiting ~= vim.NIL then return end
154154

155+
local use_git = config.use_git()
156+
if use_git then git.reload_roots() end
155157
refresh_nodes(M.Tree)
156-
157-
if config.get_icon_state().show_git_icon or vim.g.nvim_tree_git_hl == 1 then
158-
git.reload_roots()
159-
refresh_git(M.Tree)
160-
end
158+
if use_git then refresh_git(M.Tree) end
161159

162160
if vim.g.nvim_tree_lsp_diagnostics == 1 then
163161
diagnostics.update()

0 commit comments

Comments
 (0)