Skip to content
Merged
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: 5 additions & 1 deletion doc/nvim-tree-lua.txt
Original file line number Diff line number Diff line change
Expand Up @@ -698,9 +698,13 @@ Window / buffer setup.
Configuration options for floating window

*nvim-tree.view.float.enable*
Display nvim-tree window as float (enforces |nvim-tree.actions.open_file.quit_on_open| if set).
Display nvim-tree window as float (enforces if set).
Type: `boolean`, Default: `false`

*nvim-tree.view.float.quit_on_focus_loss
When in floating mode, autoclose the popup when the popup loses the focus.
Type: `boolean`, Default: `true`

*nvim-tree.view.float.open_win_config*
Floating window config. See |nvim_open_win| for more details.
Type: `table` or `function` that returns a table, Default:
Expand Down
3 changes: 2 additions & 1 deletion lua/nvim-tree.lua
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ local function setup_autocommands(opts)
})
end

if opts.view.float.enable then
if opts.view.float.enable and opts.view.float.quit_on_focus_loss then
create_nvim_tree_autocmd("WinLeave", { pattern = "NvimTree_*", callback = view.close })
end
end
Expand Down Expand Up @@ -463,6 +463,7 @@ local DEFAULT_OPTS = { -- BEGIN_DEFAULT_OPTS
},
float = {
enable = false,
quit_on_focus_loss = true,
open_win_config = {
relative = "editor",
border = "rounded",
Expand Down
2 changes: 1 addition & 1 deletion lua/nvim-tree/actions/node/open-file.lua
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ function M.fn(mode, filename)
end

function M.setup(opts)
M.quit_on_open = opts.actions.open_file.quit_on_open or opts.view.float.enable
M.quit_on_open = opts.actions.open_file.quit_on_open
M.resize_window = opts.actions.open_file.resize_window
if opts.actions.open_file.window_picker.chars then
opts.actions.open_file.window_picker.chars = tostring(opts.actions.open_file.window_picker.chars):upper()
Expand Down
2 changes: 1 addition & 1 deletion lua/nvim-tree/live-filter.lua
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ local overlay_bufnr = nil
local overlay_winnr = nil

local function remove_overlay()
if view.View.float.enable then
if view.View.float.enable and view.View.float.quit_on_focus_loss then
-- return to normal nvim-tree float behaviour when filter window is closed
a.nvim_create_autocmd("WinLeave", {
pattern = "NvimTree_*",
Expand Down