Skip to content
Closed
Show file tree
Hide file tree
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
6 changes: 6 additions & 0 deletions doc/nvim-tree-lua.txt
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ Subsequent calls to setup will replace the previous configuration.
view = {
adaptive_size = false,
centralize_selection = false,
debounce_delay = 15,
width = 30,
hide_root_folder = false,
side = "left",
Expand Down Expand Up @@ -680,6 +681,11 @@ Window / buffer setup.
initially centralized, see |zz|.
Type: `boolean`, Default: `false`

*nvim-tree.view.debounce_delay*
Idle milliseconds between BufReadPost, BufUnload and update.
The last BufReadPost or BufUnload will be focused, others are discarded.
Type: `number`, Default: `15` (ms)

*nvim-tree.view.hide_root_folder*
Hide the path of the current working directory on top of the tree.
Type: `boolean`, Default: `false`
Expand Down
9 changes: 7 additions & 2 deletions lua/nvim-tree.lua
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,9 @@ local function setup_autocommands(opts)
(filters.config.filter_no_buffer or renderer.config.highlight_opened_files ~= "none")
and vim.bo[data.buf].buftype == ""
then
reloaders.reload_explorer()
utils.debounce("BufReadPost:filter_buffer", view.debounce_delay, function()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One context should work well.

reloaders.reload_explorer()
end)
end
end,
})
Expand All @@ -380,7 +382,9 @@ local function setup_autocommands(opts)
(filters.config.filter_no_buffer or renderer.config.highlight_opened_files ~= "none")
and vim.bo[data.buf].buftype == ""
then
reloaders.reload_explorer(nil, data.buf)
utils.debounce("BufUnload:filter_buffer", view.debounce_delay, function()
reloaders.reload_explorer(nil, data.buf)
end)
end
end,
})
Expand Down Expand Up @@ -499,6 +503,7 @@ local DEFAULT_OPTS = { -- BEGIN_DEFAULT_OPTS
view = {
adaptive_size = false,
centralize_selection = false,
debounce_delay = 15,
width = 30,
hide_root_folder = false,
side = "left",
Expand Down
1 change: 1 addition & 0 deletions lua/nvim-tree/view.lua
Original file line number Diff line number Diff line change
Expand Up @@ -483,6 +483,7 @@ function M.setup(opts)
local options = opts.view or {}
M.View.adaptive_size = options.adaptive_size
M.View.centralize_selection = options.centralize_selection
M.View.debounce_delay = options.debounce_delay
M.View.side = (options.side == "right") and "right" or "left"
M.View.width = options.width
M.View.height = options.height
Expand Down