feat: add exclude filter list (#878)

This commit is contained in:
Michael
2022-01-21 11:48:58 +02:00
committed by GitHub
parent a896a2b5a2
commit 9e2f6b6f25
3 changed files with 16 additions and 1 deletions

View File

@@ -5,6 +5,7 @@ local utils = require'nvim-tree.utils'
local M = {
ignore_list = {},
exclude_list = {},
is_windows = vim.fn.has('win32') == 1
}
@@ -122,6 +123,12 @@ end
local function should_ignore(path)
local basename = utils.path_basename(path)
for _, entry in ipairs(M.exclude_list) do
if path:match(entry) then
return false
end
end
if M.config.filter_dotfiles then
if basename:sub(1, 1) == '.' then
return true
@@ -353,6 +360,8 @@ function M.setup(opts)
filter_dotfiles = opts.filters.dotfiles,
}
M.exclude_list = opts.filters.exclude
local custom_filter = opts.filters.custom
if custom_filter and #custom_filter > 0 then
for _, entry in pairs(custom_filter) do