diff --git a/doc/nvim-tree-lua.txt b/doc/nvim-tree-lua.txt index 86e85189ee2..78f0f7dd007 100644 --- a/doc/nvim-tree-lua.txt +++ b/doc/nvim-tree-lua.txt @@ -405,7 +405,8 @@ Here is a list of the options available in the setup call: type: `boolean` default: `false` - - |filters.custom|: custom list of string that will not be shown. + - |filters.custom|: custom list of vim regex for file/directory names that will not be shown. + Backslashes must be escaped e.g. "^\\.git". See |string-match|. type: `{string}` default: `{}` diff --git a/lua/nvim-tree/explorer/filters.lua b/lua/nvim-tree/explorer/filters.lua index 958a9a9bccc..8ec661e2e7f 100644 --- a/lua/nvim-tree/explorer/filters.lua +++ b/lua/nvim-tree/explorer/filters.lua @@ -35,8 +35,10 @@ function M.should_ignore(path) end local relpath = utils.path_relative(path, vim.loop.cwd()) - if M.ignore_list[relpath] == true or M.ignore_list[basename] == true then - return true + for pat, _ in pairs(M.ignore_list) do + if vim.fn.match(relpath, pat) ~= -1 or vim.fn.match(basename, pat) ~= -1 then + return true + end end local idx = path:match ".+()%.[^.]+$"