Skip to content

Commit 9fbe180

Browse files
committed
feat(open): add window_picker.picker
1 parent 0cd8ac4 commit 9fbe180

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

lua/nvim-tree.lua

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -640,6 +640,7 @@ local DEFAULT_OPTS = { -- BEGIN_DEFAULT_OPTS
640640
resize_window = true,
641641
window_picker = {
642642
enable = true,
643+
picker = "default",
643644
chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890",
644645
exclude = {
645646
filetype = { "notify", "packer", "qf", "diff", "fugitive", "fugitiveblame" },
@@ -699,6 +700,7 @@ local FIELD_OVERRIDE_TYPECHECK = {
699700
on_attach = { ["function"] = true, string = true },
700701
sort_by = { ["function"] = true, string = true },
701702
root_folder_label = { ["function"] = true, string = true },
703+
picker = { ["function"] = true, string = true },
702704
}
703705

704706
local function validate_options(conf)

lua/nvim-tree/actions/node/open-file.lua

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,11 @@ local function get_target_winid(mode, win_ids)
175175
end
176176
else
177177
-- pick a window
178-
target_winid = pick_win_id()
178+
if type(M.window_picker.picker) == "function" then
179+
target_winid = M.window_picker.picker()
180+
else
181+
target_winid = pick_win_id()
182+
end
179183
if target_winid == nil then
180184
-- pick failed/cancelled
181185
return

0 commit comments

Comments
 (0)