refactor(#2826): View tracks winids and bufnrs via events, unused for now (#3170)

* refactor(#2826): add View.bufnr and use for all public methods

* use View.bufnr for all internal methods

* revert View.bufnr, add buffer local autocommands

* View revert to globals.BUFNR_BY_TABID until bufnr and winid are tracked for the view

* View track winids and bufnrs via events
This commit is contained in:
Alexander Courtis
2025-07-29 14:19:24 +10:00
committed by GitHub
parent a9156c0139
commit 65bae44922
2 changed files with 77 additions and 34 deletions

View File

@@ -165,22 +165,6 @@ function Explorer:create_autocmds()
end,
})
-- prevent new opened file from opening in the same window as nvim-tree
vim.api.nvim_create_autocmd("BufWipeout", {
group = self.augroup_id,
pattern = "NvimTree_*",
callback = function()
if not utils.is_nvim_tree_buf(0) then
return
end
if self.opts.actions.open_file.eject then
self.view:prevent_buffer_override()
else
self.view:abandon_current_window()
end
end,
})
vim.api.nvim_create_autocmd("BufEnter", {
group = self.augroup_id,
pattern = "NvimTree_*",