Skip to content

Commit c3ea264

Browse files
authored
feat(view): allow function for view.float.open_win_config (#1538)
1 parent 259efee commit c3ea264

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

doc/nvim-tree-lua.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -669,7 +669,7 @@ Window / buffer setup.
669669

670670
*nvim-tree.view.float.open_win_config*
671671
Floating window config. See |nvim_open_win| for more details.
672-
Type: `table`, Default:
672+
Type: `table` or `function` that returns a table, Default:
673673
`{`
674674
`relative = "editor",`
675675
`border = "rounded",`

lua/nvim-tree/view.lua

+9-1
Original file line numberDiff line numberDiff line change
@@ -133,9 +133,17 @@ local function set_window_options_and_buffer()
133133
end
134134
end
135135

136+
local function open_win_config()
137+
if type(M.View.float.open_win_config) == "function" then
138+
return M.View.float.open_win_config()
139+
else
140+
return M.View.float.open_win_config
141+
end
142+
end
143+
136144
local function open_window()
137145
if M.View.float.enable then
138-
a.nvim_open_win(0, true, M.View.float.open_win_config)
146+
a.nvim_open_win(0, true, open_win_config())
139147
else
140148
a.nvim_command "vsp"
141149
M.reposition_window()

0 commit comments

Comments
 (0)