Skip to content

[WIP] allow passing a custom function as a window picker #1782

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
2 changes: 2 additions & 0 deletions lua/nvim-tree.lua
Original file line number Diff line number Diff line change
Expand Up @@ -621,6 +621,7 @@ local DEFAULT_OPTS = { -- BEGIN_DEFAULT_OPTS
resize_window = true,
window_picker = {
enable = true,
custom_function = nil,
chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890",
exclude = {
filetype = { "notify", "packer", "qf", "diff", "fugitive", "fugitiveblame" },
Expand Down Expand Up @@ -672,6 +673,7 @@ end

local FIELD_SKIP_VALIDATE = {
open_win_config = true,
custom_function = true,
}

local FIELD_OVERRIDE_TYPECHECK = {
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 @@ -175,7 +175,7 @@ local function get_target_winid(mode, win_ids)
end
else
-- pick a window
target_winid = pick_win_id()
target_winid = M.window_picker.custom_function and M.window_picker.custom_function() or pick_win_id()
if target_winid == nil then
-- pick failed/cancelled
return
Expand Down