Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion lua/nvim-tree/view.lua
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,14 @@ local function open_window()
if config.g.view.float.enable then
vim.api.nvim_open_win(0, true, open_win_config())
else
vim.api.nvim_command("vsp")
local ei = vim.o.eventignore
vim.o.eventignore = "all"
vim.api.nvim_open_win(M.get_bufnr(), true, {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the reason for this change from vsp?

This code is very fagile and has to handle a lot of edge cases.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LLM might have not 'known' about it though…

Copy link
Copy Markdown
Author

@0ax1 0ax1 Apr 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

vim.api.nvim_command("vsp") opens a vsplit showing the current buffer in the new split first and then swapping it after in my understanding. What I'm trying to do here is ignore displaying intermediate steps via local ei = vim.o.eventignore, set the correct buffer from the start vim.api.nvim_open_win(M.get_bufnr(), position the window like before M.reposition_window(), and then finally make the changes visible vim.o.eventignore = ei.

Right now I see a glitch each time I toggle nvim-tree to visible, as in I can see that vsp initially splits the buffer has the content of the current buffer, before it repositions and shows the content of the file tree.

So the repro really only is toggle nvim-tree, not using a float window.

Copy link
Copy Markdown
Author

@0ax1 0ax1 Apr 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gegoune Yeah I've been iterating with on this with Claude, and might be totally possible that some subtleties have been missed. I never really went deep on nvim plugins before but this seemed reasonable as a first iteration.

@alex-courtis Maybe it's possible to keep vsp if we ignore intermediate events local ei = vim.o.eventignore?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like set_window_options_and_buffer is already temporarily setting eventignore via vim.api.nvim_set_option. Using eventignore is very dangerous and we use it only when we absolutely have to.

I can't see the flicker however I do understand how it occurs. If I comment out set_window_options_and_buffer it does indeed show the current buffer in the tree window.

@alex-courtis Maybe it's possible to keep vsp if we ignore intermediate events local ei = vim.o.eventignore?

I did try wrapping vsp with the eventignore, however that had no effect - the current buffer is still displayed.

split = config.g.view.side or "left",
width = view_state.get_width(),
})
M.reposition_window()
vim.o.eventignore = ei
end
setup_tabpage(vim.api.nvim_get_current_tabpage())
set_window_options_and_buffer()
Expand Down
Loading