Skip to content

Add a popup feature to display diagram image in a popup window#38

Open
Mrzrb wants to merge 3 commits into3rd:masterfrom
Mrzrb:feature/popups
Open

Add a popup feature to display diagram image in a popup window#38
Mrzrb wants to merge 3 commits into3rd:masterfrom
Mrzrb:feature/popups

Conversation

@Mrzrb
Copy link

@Mrzrb Mrzrb commented Dec 8, 2025

Hi! I hope you're doing well. Great work on this plugin – it's been really helpful for me!

I noticed that your image.nvim plugin includes a popup feature, while diagram.nvim currently doesn't have one. I've implemented this functionality and would greatly appreciate it if you could review this PR.

Implementation highlights:

Added a popup feature for displaying diagrams
The popup window automatically detects the current buffer's window size and adapts accordingly for optimal viewing
Thank you for your time and consideration!

Thx!

Just like this
image

Mrzrb added 2 commits December 8, 2025 23:59
  - Fix image position in popup floating window
  - Add calculate_popup_size function for proper size calculation
  - Scale down large images to fit 90% of terminal while maintaining aspect ratio
  - Use image.nvim's adjust_to_aspect_ratio for consistent sizing
  - Refactor code to match project style (local x = function pattern)
  - Use vim.defer_fn for rendering like image.nvim does
@cprn
Copy link

cprn commented Dec 23, 2025

It'd (at least partially, if not fully) solve the issue that caused me to ask for #36. If we were able to optionally “glue” that popup in place in the middle of the right edge of the terminal, then it'd solve that feature request directly.

@Mrzrb
Copy link
Author

Mrzrb commented Jan 12, 2026

It'd (at least partially, if not fully) solve the issue that caused me to ask for #36. If we were able to optionally “glue” that popup in place in the middle of the right edge of the terminal, then it'd solve that feature request directly.

Position in this implement is dynamic, it depends on the window size, it's calculated dynamically. But is's easy to add an option to set the popup window to specific position.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants