Popup images under the cursor and render LaTeX selections directly in Vim.
Requires Vim 9.2+, Python 3, Pillow, and matplotlib.
Using vim-plug
Plug 'JosefAlbers/thumb'Then run:
:PlugInstallInstall the Python dependencies:
python3 -m pip install Pillow matplotlibYou can just clone the repository directly into Vim's package directory, e.g.,:
git clone https://github.com/JosefAlbers/thumb ~/.vim/pack/thumb/start/thumbIf you use a different Vim configuration directory, use the corresponding pack/*/start/ directory instead.
Put the cursor on an image filename:

Then run:
:ThumbThe image is rendered as a popup anchored below the cursor.
Relative paths are resolved relative to the current file.
Select a LaTeX expression in Visual mode:
\begin{eqnarray*}
\mathcal{F} &=& \int f\left( \phi, c \right) dV, \\
\frac{ \partial \phi } { \partial t } &=& -M_{ \phi }
\frac{ \delta \mathcal{F} } { \delta \phi }
\end{eqnarray*}
Then run:
:'<,'>ThumbOr simply:
:Thumbwhile the selection is active.
The selection is rendered as a popup anchored below the selected text.
Press t while the popup has focus.
Python executable:
let g:thumb_python = 'python3'Image popup height, in terminal cells:
let g:thumb_height = 8LaTeX popup height, in terminal cells:
let g:thumb_math_height = 4By default, text.usetex is enabled. To disable it to use matplotlib's built-in mathtext renderer:
let g:thumb_latex_usetex = 0text.usetex requires LaTeX installation
For example:
let g:thumb_python = '/opt/homebrew/bin/python3'
let g:thumb_height = 10
let g:thumb_math_height = 5
let g:thumb_latex_usetex = 0thumb does not install any mappings. Add your own if desired:
nnoremap <leader>t <Cmd>Thumb<CR>
xnoremap <leader>t :Thumb<CR>- Vim 9.2+
- Python 3
- Pillow
- matplotlib
Vim must have popup image support (+popupwin and +terminal/image support as appropriate for your build).
MIT