Skip to content

Commit 5499299

Browse files
authored
fix(#3178): handle Windows paths in ignore_dirs and add .zig-cache to defaults (#3261)
* feat: add .zig-cache in default ignored_dirs * feat: correctly add .zig-cache in default ignored_dirs * fix(#3178): handle windows paths in ignore_dirs * fix: remove unsed print statement * fix: tab formatting * chore: match with documentation * chore: double espace backslashes and revert unrelated formatting * chore: correctly rever unrelated formatting * chore: indenting explorer/watch * fix: remove unneeded print * chore: remove unneeded true check * chore: adding .zig-cache into nvim-tree.lua * chore: add /.zig-cache under filesystem_watchers * chore: regenerate docs
1 parent e11ce83 commit 5499299

File tree

4 files changed

+8
-2
lines changed

4 files changed

+8
-2
lines changed

doc/nvim-tree-lua.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1707,7 +1707,7 @@ Config: filesystem_watchers *nvim-tree-config-filesystem-watchers*
17071707
{enable}? (`boolean`) (default: `true`)
17081708
• {debounce_delay}? (`integer`, default: `50`) Idle milliseconds
17091709
between filesystem change and tree update.
1710-
• {ignore_dirs}? (`string[]|(fun(path: string): boolean)`, default: `{ "/.ccls-cache", "/build", "/node_modules", "/target", }`)
1710+
• {ignore_dirs}? (`string[]|(fun(path: string): boolean)`, default: `{ "/.ccls-cache", "/build", "/node_modules", "/target", "/.zig-cache"}`)
17111711
Disable for specific directories.
17121712
• {max_events}? (`integer`, default: `1000`) Disable for a single
17131713
directory after {max_events} consecutive events
@@ -2188,6 +2188,7 @@ Following is the default configuration, see |nvim_tree.config| for details. >lua
21882188
"/build",
21892189
"/node_modules",
21902190
"/target",
2191+
"/.zig-cache",
21912192
},
21922193
},
21932194
actions = {

lua/nvim-tree.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -469,6 +469,7 @@ local DEFAULT_OPTS = { -- default-config-start
469469
"/build",
470470
"/node_modules",
471471
"/target",
472+
"/.zig-cache",
472473
},
473474
},
474475
actions = {

lua/nvim-tree/_meta/config/filesystem_watchers.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ error("Cannot require a meta file")
2727
---@field debounce_delay? integer
2828
---
2929
---Disable for specific directories.
30-
---(default: `{ "/.ccls-cache", "/build", "/node_modules", "/target", }`)
30+
---(default: `{ "/.ccls-cache", "/build", "/node_modules", "/target", "/.zig-cache"}`)
3131
---@field ignore_dirs? string[]|(fun(path: string): boolean)
3232
---
3333
---Disable for a single directory after {max_events} consecutive events with an interval < {debounce_delay}.

lua/nvim-tree/explorer/watch.lua

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@ local function is_folder_ignored(path)
4444

4545
if type(M.config.filesystem_watchers.ignore_dirs) == "table" then
4646
for _, ignore_dir in ipairs(M.config.filesystem_watchers.ignore_dirs) do
47+
if utils.is_windows then
48+
ignore_dir = ignore_dir:gsub("/", "\\\\") or ignore_dir
49+
end
50+
4751
if vim.fn.match(path, ignore_dir) ~= -1 then
4852
return true
4953
end

0 commit comments

Comments
 (0)