fix gitignore feature (#264)

This commit is contained in:
peach lasagna
2021-04-01 02:37:29 +07:00
committed by GitHub
parent d19a6feb24
commit 1f1b25de4b
4 changed files with 8 additions and 13 deletions

View File

@@ -101,20 +101,16 @@ end
local function gen_ignore_check()
local ignore_list = {}
local function add_toignore(path)
local content = utils.read_file(path)
local function add_toignore(content)
for s in content:gmatch("[^\r\n]+") do
ignore_list[s] = true
end
end
if (vim.g.nvim_tree_gitignore or 0) > 0 then
add_toignore('.gitignore')
if (vim.g.nvim_tree_gitignore or 0) == 1 then
add_toignore(git.get_gitexclude())
end
if (vim.g.nvim_tree_gitignore or 0) == 2 then
add_toignore(git.get_path_gitexclude())
end
if vim.g.nvim_tree_ignore and #vim.g.nvim_tree_ignore > 0 then
for _, entry in pairs(vim.g.nvim_tree_ignore) do
ignore_list[entry] = true