Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion lua/nvim-tree/explorer/filters.lua
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,20 @@ end
---@param path string
---@param bookmarks table<string, boolean> absolute paths bookmarked
local function bookmark(path, bookmarks)
return M.config.filter_no_bookmark and not bookmarks[path]
if not M.config.filter_no_bookmark then
return false
end

-- add trailing slash to make it match only mark's parent directory
-- not it's siblings
local parent = utils.path_add_trailing(path)
for mark, _ in pairs(bookmarks) do
if path == mark or vim.fn.stridx(mark, parent) == 0 then
return false
end
end

return true
end

---@param path string
Expand Down