Skip to content

Commit

Permalink
feat: add setup.view_options.is_excluded
Browse files Browse the repository at this point in the history
  • Loading branch information
nyngwang committed Mar 5, 2023
1 parent 4152810 commit 19ab948
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 4 additions & 0 deletions lua/oil/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ local default_config = {
is_hidden_file = function(name, bufnr)
return vim.startswith(name, ".")
end,
-- This function defines what will never be shown, even when `show_hidden` is set
is_excluded = function (name, bufnr)
return false
end
},
-- Configuration for the floating window in oil.open_float
float = {
Expand Down
3 changes: 2 additions & 1 deletion lua/oil/view.lua
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ local last_cursor_entry = {}
---@return boolean
M.should_display = function(entry, bufnr)
local name = entry[FIELD.name]
return config.view_options.show_hidden or not config.view_options.is_hidden_file(name, bufnr)
return not config.view_options.is_excluded(name, bufnr)
and (not config.view_options.is_hidden_file(name, bufnr) or config.view_options.show_hidden)
end

---@param bufname string
Expand Down

0 comments on commit 19ab948

Please sign in to comment.