-
-
Notifications
You must be signed in to change notification settings - Fork 624
fix(#1629): nvim start with file named *NvimTree* opens tree instead of buffer #1634
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
fix(#1629): nvim start with file named *NvimTree* opens tree instead of buffer #1634
Conversation
lua/nvim-tree.lua
Outdated
-- Session that left a NvimTree Buffer opened, reopen with it | ||
local existing_tree_wins = find_existing_windows() | ||
if existing_tree_wins[1] then | ||
api.nvim_set_current_win(existing_tree_wins[1]) | ||
end | ||
|
||
if should_open or existing_tree_wins[1] ~= nil then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think this is needed for user using sessions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe a better fix would be to change the matching string to NvimTree_
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch; I didn't think of nvim sessions, just user calling setup multiple times.
Added a util to check that the buffer name matches and that it is a real file. We can't test file type as it's not imported via default sessionoptions
.
@barrett-ruth I'd be grateful for a re-test.
…instead of buffer" This reverts commit e713607.
Raised #1639 to be completed in a separate branch. |
@alex-courtis works great for me. |
… instead of buffer (nvim-tree#1634) * fix(nvim-tree#1629): nvim start with file named *NvimTree* opens tree instead of buffer * Revert "fix(nvim-tree#1629): nvim start with file named *NvimTree* opens tree instead of buffer" This reverts commit e713607. * fix(nvim-tree#1629): nvim start with file named *NvimTree* treats file as tree * fix(nvim-tree#1629): nvim start with file named *NvimTree* treats file as tree
fixes #1629
find_existing_windows misidentifies a buffer named
*NvimTree*
as the tree's buffer.setup
->on_enter
->find_existing_windows
is the only codepathsetup
∴ this may be removed