You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Originally posted by paulrouget February 10, 2023
I have window_picker disabled. And the picked window is the most ancient window. Is it possible to automatically pick the most left-top window?
changed the title [-]Anyway to automatically pick the most left window?[/-][+]Topleftest Window Not Picked When `actions.open_file.window_picker.enable` false[/+]on Feb 11, 2023
Tracking the previously focused window when entering the nvim-tree window is impractical via events.
Things are working exactly as per the doc, with the window from which the tree was opened being used:
*nvim-tree.actions.open_file.window_picker.enable*
Enable the feature. If the feature is not enabled, files will open in window
from which you last opened the tree.
Type: `boolean`, Default: `true`
@paulrouget could you live with using :NvimTreeFocus to navigate to nvim-tree?
Is there really no way to open to the window that was previously active before selecting the nvim-tree window (regardless on navigation method)?
I have the same problem as @paulrouget, however I often use the mouse to start interacting with nvim-tree (to open a file, for instance). If I don't use :NvimTreeFocus, then it opens the file in the last window to have previously used :NvimTreeFocus (or presumably have been created by nvim-tree).
Would it be possible to use the lua equivalent of :winnr(#) (if it exists)?
Would it be possible to track the previous window by an event that fires every time you leave a window? Like maybe the WinLeaveautocmd event? We could add another WinLeave autocmd similar to the one defined here, but using a negated pattern to ignore unwanted buffers like NvimTree_*.
Activity
alex-courtis commentedon Feb 11, 2023
The topleftest window should be picked in this situation.
Looks like a bug with first_win_id not being called
nvim-tree.lua/lua/nvim-tree/actions/node/open-file.lua
Line 167 in d85b671
[-]Anyway to automatically pick the most left window?[/-][+]Topleftest Window Not Picked When `actions.open_file.window_picker.enable` false[/+]alex-courtis commentedon Feb 12, 2023
Further experimentation indicates that nvim-tree attempts to use the most recently used window, then the topleftest.
Most recently used is set on open, focus etc. but not when manually moving to the nvim-tree window.
alex-courtis commentedon Feb 12, 2023
Tracking the previously focused window when entering the nvim-tree window is impractical via events.
Things are working exactly as per the doc, with the window from which the tree was opened being used:
@paulrouget could you live with using
:NvimTreeFocus
to navigate to nvim-tree?paulrouget commentedon Feb 13, 2023
Absolutely! Changed my bindings to use
:NvimTreeFocus
instead of jumping to the window, and it works perfectly.Thank you.
alex-courtis commentedon Feb 13, 2023
That's good to hear; there's no nice way to do it otherwise...
zhimsel commentedon Jun 8, 2023
Is there really no way to open to the window that was previously active before selecting the nvim-tree window (regardless on navigation method)?
I have the same problem as @paulrouget, however I often use the mouse to start interacting with
nvim-tree
(to open a file, for instance). If I don't use:NvimTreeFocus
, then it opens the file in the last window to have previously used:NvimTreeFocus
(or presumably have been created by nvim-tree).Would it be possible to use the lua equivalent of
:winnr(#)
(if it exists)?Would it be possible to track the previous window by an event that fires every time you leave a window? Like maybe the
WinLeave
autocmd event? We could add anotherWinLeave
autocmd similar to the one defined here, but using a negated pattern to ignore unwanted buffers likeNvimTree_*
.alex-courtis commentedon Jun 10, 2023
@zhimsel it sounds like you have encountered a bug; the previously active window should be chosen when the window picker is disabled.
Please raise a Bug Report with minimal configuration and detailed replication instructions.
zhimsel commentedon Jun 10, 2023
Done: #2262