File tree Expand file tree Collapse file tree 2 files changed +14
-18
lines changed
lua/nvim-tree/actions/node Expand file tree Collapse file tree 2 files changed +14
-18
lines changed Original file line number Diff line number Diff line change @@ -1523,7 +1523,8 @@ Configuration options for opening a file from nvim-tree.
15231523
15241524 *nvim-tree.actions.open_file.window_picker.enable*
15251525 Enable the feature. If the feature is not enabled, files will open in
1526- window from which you last opened the tree.
1526+ window from which you last opened the tree, obeying
1527+ | nvim-tree.actions.open_file.window_picker.exclude |
15271528 Type: `boolean ` , Default: `true`
15281529
15291530 *nvim-tree.actions.open_file.window_picker.picker*
@@ -1542,9 +1543,10 @@ Configuration options for opening a file from nvim-tree.
15421543 Type: `string ` , Default: `" ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890" `
15431544
15441545 *nvim-tree.actions.open_file.window_picker.exclude*
1545- Table of buffer option names mapped to a list of option values that
1546- indicates to the picker that the buffer's window should not be
1547- selectable.
1546+ Table of buffer option names mapped to a list of option values.
1547+ Windows containing matching buffers will not be:
1548+ - available when using a window picker
1549+ - selected when not using a window picker
15481550 Type: `table` , Default: >lua
15491551 {
15501552 filetype = {
Original file line number Diff line number Diff line change @@ -43,17 +43,6 @@ local function usable_win_ids()
4343 end , win_ids )
4444end
4545
46- --- Find the first window in the tab that is not NvimTree.
47- --- @return integer -1 if none available
48- local function first_win_id ()
49- local selectable = usable_win_ids ()
50- if # selectable > 0 then
51- return selectable [1 ]
52- else
53- return - 1
54- end
55- end
56-
5746--- Get user to pick a window in the tab that is not NvimTree.
5847--- @return integer | nil -- If a valid window was picked , return its id. If an
5948--- invalid window was picked / user canceled, return nil. If there are
@@ -246,9 +235,14 @@ local function get_target_winid(mode)
246235 local target_winid
247236 if not M .window_picker .enable or string.find (mode , " no_picker" ) then
248237 target_winid = lib .target_winid
249- -- first available window
250- if not vim .tbl_contains (vim .api .nvim_tabpage_list_wins (0 ), target_winid ) then
251- target_winid = first_win_id ()
238+ local usable_wins = usable_win_ids ()
239+ -- first available usable window
240+ if not vim .tbl_contains (usable_wins , target_winid ) then
241+ if # usable_wins > 0 then
242+ target_winid = usable_wins [1 ]
243+ else
244+ target_winid = - 1
245+ end
252246 end
253247 else
254248 -- pick a window
You can’t perform that action at this time.
0 commit comments