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 (0)