diff --git a/doc/nvim-tree-lua.txt b/doc/nvim-tree-lua.txt index fcf0ef1bf3e..999bf7436b2 100644 --- a/doc/nvim-tree-lua.txt +++ b/doc/nvim-tree-lua.txt @@ -2276,6 +2276,7 @@ Following is the default configuration, see |nvim_tree.config| for details. >lua "/build", "/node_modules", "/target", + "/.zig-cache", }, }, actions = { diff --git a/lua/nvim-tree.lua b/lua/nvim-tree.lua index 4d4dad7b1f3..03a3e35ad70 100644 --- a/lua/nvim-tree.lua +++ b/lua/nvim-tree.lua @@ -122,7 +122,6 @@ function M.open_on_directory() return end - local explorer = core.get_explorer() if not explorer then core.init(bufname) @@ -469,6 +468,7 @@ local DEFAULT_OPTS = { -- default-config-start "/build", "/node_modules", "/target", + "/.zig-cache", }, }, actions = { @@ -642,7 +642,7 @@ local ACCEPTED_STRINGS = { local ACCEPTED_ENUMS = { view = { width = { - lines_excluded = { "root", }, + lines_excluded = { "root" }, }, }, } @@ -683,8 +683,11 @@ local function validate_options(conf) if enum_value then if not vim.tbl_contains(enums, v) then - invalid = string.format("Invalid value for field %s%s: Expected one of enum '%s', got '%s'", prefix, k, - table.concat(enums, "'|'"), tostring(v)) + invalid = string.format("Invalid value for field %s%s: Expected one of enum '%s', got '%s'", + prefix, + k, + table.concat(enums, "'|'"), + tostring(v)) end else if def[k] == nil and types[k] == nil then diff --git a/lua/nvim-tree/explorer/watch.lua b/lua/nvim-tree/explorer/watch.lua index 2ce5051c69a..bae4f531652 100644 --- a/lua/nvim-tree/explorer/watch.lua +++ b/lua/nvim-tree/explorer/watch.lua @@ -44,6 +44,10 @@ local function is_folder_ignored(path) if type(M.config.filesystem_watchers.ignore_dirs) == "table" then for _, ignore_dir in ipairs(M.config.filesystem_watchers.ignore_dirs) do + if utils.is_windows or true then + ignore_dir = ignore_dir:gsub("/", "\\") or ignore_dir + end + if vim.fn.match(path, ignore_dir) ~= -1 then return true end @@ -76,13 +80,15 @@ function M.create_watcher(node) -- disable watcher when outstanding exceeds max if watcher.data.outstanding_events > M.config.filesystem_watchers.max_events then - notify.error(string.format( - "Observed %d consecutive file system events with interval < %dms, exceeding filesystem_watchers.max_events=%s. Disabling watcher for directory '%s'. Consider adding this directory to filesystem_watchers.ignore_dirs", - watcher.data.outstanding_events, - M.config.filesystem_watchers.max_events, - M.config.filesystem_watchers.debounce_delay, - node.absolute_path - )) + notify.error( + string.format( + "Observed %d consecutive file system events with interval < %dms, exceeding filesystem_watchers.max_events=%s. Disabling watcher for directory '%s'. Consider adding this directory to filesystem_watchers.ignore_dirs", + watcher.data.outstanding_events, + M.config.filesystem_watchers.max_events, + M.config.filesystem_watchers.debounce_delay, + node.absolute_path + ) + ) node:destroy_watcher() end @@ -110,7 +116,7 @@ function M.create_watcher(node) data = { context = "explorer:watch:" .. path .. ":" .. M.uid, outstanding_events = 0, -- unprocessed events that have not been debounced - } + }, }) end