DEV Community

Josef Albers
Josef Albers

Posted on

thumb: popup images and render LaTeX directly in Vim

I made a small Vim 9.2+ plugin called thumb.

  • Put the cursor on an image path → :Thumb → popup the image.
  • Select LaTeX in Visual mode → :Thumb → render it as an image popup.

For example:

![diagram](images/diagram.png)
Enter fullscreen mode Exit fullscreen mode

Put the cursor on diagram.png and run:

:Thumb
Enter fullscreen mode Exit fullscreen mode

Or select:

\frac{a}{b} = \sqrt{x^2 + y^2}
Enter fullscreen mode Exit fullscreen mode

and run:

:Thumb
Enter fullscreen mode Exit fullscreen mode

It uses Vim's native popup image support, with Python/Pillow for image conversion and matplotlib for LaTeX rendering.

No mappings are installed, so you can add your own:

nnoremap <leader>t <Cmd>Thumb<CR>
xnoremap <leader>t <Cmd>Thumb<CR>
Enter fullscreen mode Exit fullscreen mode

GitHub: https://github.com/JosefAlbers/thumb

Requires Vim 9.2+, Python 3, Pillow, and matplotlib.

Feedback welcome, particularly around the popup positioning/rendering.

Top comments (1)

Collapse
 
loudify profile image
Deadato

Your GitHub link isn't clickable. It's wrapped in backticks, so it renders as code - there are zero links in the whole post. Anyone who wants the repo has to select the text and paste it into a browser, and most won't. That's the only route to the thing you built.

You asked for feedback on popup positioning and this isn't that - I can't run Vim 9.2 to test it. This is just the part anyone can check from the outside.

The other thing: at 119 words this reads as a README, not a launch post. "It uses Vim's native popup image support" is the line that earns attention, and it sits after four code blocks.

Wrote you a launch post, free, use it or bin it:

"thumb is a Vim 9.2+ plugin: put the cursor on an image path and the image pops up in the editor; select LaTeX in Visual mode and it renders the same way. It uses Vim's native popup image support, with Python/Pillow for image conversion and matplotlib for LaTeX rendering. No mappings are installed, so you add your own."

Full disclosure so it isn't strange: I build a tool that writes these. Nothing to sign up for and nothing to click - the post is yours either way.