Skip to content

Commit eaec70f

Browse files
feat: add float autoclose option
1 parent 7282f7d commit eaec70f

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

doc/nvim-tree-lua.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -701,6 +701,10 @@ Window / buffer setup.
701701
Display nvim-tree window as float (enforces |nvim-tree.actions.open_file.quit_on_open| if set).
702702
Type: `boolean`, Default: `false`
703703

704+
*nvim-tree.view.float.autoclose
705+
When in floating mode, autoclose the popup when the popup loses the focus.
706+
Type: `boolean`, Default: `true`
707+
704708
*nvim-tree.view.float.open_win_config*
705709
Floating window config. See |nvim_open_win| for more details.
706710
Type: `table` or `function` that returns a table, Default:

lua/nvim-tree.lua

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,7 @@ local function setup_autocommands(opts)
418418
})
419419
end
420420

421-
if opts.view.float.enable then
421+
if opts.view.float.enable and opts.view.float.autoclose then
422422
create_nvim_tree_autocmd("WinLeave", { pattern = "NvimTree_*", callback = view.close })
423423
end
424424
end
@@ -463,6 +463,7 @@ local DEFAULT_OPTS = { -- BEGIN_DEFAULT_OPTS
463463
},
464464
float = {
465465
enable = false,
466+
autoclose = true,
466467
open_win_config = {
467468
relative = "editor",
468469
border = "rounded",

0 commit comments

Comments
 (0)