-
-
Notifications
You must be signed in to change notification settings - Fork 629
fix: prevent quit_on_open from opening file in the same window #1637
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
Conversation
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.
Tested OK: #1628 (comment)
lua/nvim-tree.lua
Outdated
@@ -373,7 +373,7 @@ local function setup_autocommands(opts) | |||
if not opts.actions.open_file.quit_on_open then | |||
create_nvim_tree_autocmd("BufWipeout", { pattern = "NvimTree_*", callback = view._prevent_buffer_override }) | |||
else | |||
create_nvim_tree_autocmd("BufWipeout", { pattern = "NvimTree_*", callback = view.abandon_current_window }) | |||
create_nvim_tree_autocmd("BufWipeout", { pattern = "NvimTree_*", callback = view._prevent_buffer_override }) |
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.
remove if; both branches are the same
Also resolves an issue when loading a session with
|
@alex-courtis I added a fix for opening a file using :e when the floating window is open, it was opening the file in a new vspilt, now it opens the file in a new buffer instead of a new window, what do u think? |
Let's just keep it consistent with non-floating: open in the previous (not picked) window. |
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.
Tested OK:
- defaults
- quit_on_open
- float
- float quit_on_open
create_nvim_tree_autocmd("BufWipeout", { | ||
pattern = "NvimTree_*", | ||
callback = function() | ||
if vim.bo.filetype == "NvimTree" 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.
nice
…nvim-tree#1637) * fix: prevent quit_on_open from opening in same window * chore: remove condition for quit_on_open * fix: prevent opening file in a new window on floting nvim-tree * stylua Co-authored-by: Alexander Courtis <[email protected]>
fixes #1628
call
view._prevent_buffer_override
onBufWipeout
instead ofview.abandon_current_window
whenquit_on_open = true