Skip to content

Commit ef2ef2e

Browse files
committed
feat: allow passing a custom function as a window picker
WIP
1 parent 0b319a1 commit ef2ef2e

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

lua/nvim-tree.lua

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -621,6 +621,7 @@ local DEFAULT_OPTS = { -- BEGIN_DEFAULT_OPTS
621621
resize_window = true,
622622
window_picker = {
623623
enable = true,
624+
custom_function = nil,
624625
chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890",
625626
exclude = {
626627
filetype = { "notify", "packer", "qf", "diff", "fugitive", "fugitiveblame" },
@@ -672,6 +673,7 @@ end
672673

673674
local FIELD_SKIP_VALIDATE = {
674675
open_win_config = true,
676+
custom_function = true,
675677
}
676678

677679
local FIELD_OVERRIDE_TYPECHECK = {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ local function get_target_winid(mode, win_ids)
175175
end
176176
else
177177
-- pick a window
178-
target_winid = pick_win_id()
178+
target_winid = M.window_picker.custom_function and M.window_picker.custom_function() or pick_win_id()
179179
if target_winid == nil then
180180
-- pick failed/cancelled
181181
return

0 commit comments

Comments
 (0)