-
Notifications
You must be signed in to change notification settings - Fork 92
Open
Description
Problem
The document integration in lua/image/utils/document.lua sets up autocmds to detect window/buffer changes and re-render images:
vim.api.nvim_create_autocmd({ "WinNew", "BufWinEnter", "TabEnter" }, {BufEnter is missing from this list. BufWinEnter only fires the first time a buffer is displayed in a window — it does not fire when revisiting an already-loaded buffer. This means images fail to render in common workflows:
- Opening a file from nvim-tree: selecting a markdown file from the tree opens it in an adjacent window, but if the buffer was previously loaded, only
BufEnterfires (notBufWinEnter), so images don't render - Switching buffers:
:bnext,:bprev, or buffer pickers switching to a previously-visited buffer only fireBufEnter
Steps to reproduce
- Open a markdown file with images via a document integration (e.g. diagram.nvim)
- Navigate away (e.g. open another file, or focus nvim-tree)
- Return to the markdown buffer via nvim-tree,
:bnext, or a buffer picker - Images don't render until another trigger fires (e.g.
:eto reload)
Expected behavior
Images should re-render whenever a buffer with a document integration becomes active, regardless of whether it was previously loaded.
Suggested fix
Add "BufEnter" to the autocmd event list. BufEnter fires every time a buffer becomes active in a window, complementing BufWinEnter (first display only), WinNew, and TabEnter.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels