This is a basic guide that allows you to see images previews inside of neovim. The image will be generated via timg and the output will be shown inside the vim buffer.
First, you should have timg
installed on your system:
sudo snap install timg
Just set up this autocommand:
vim.cmd([[
au BufEnter *.jpg,*.png terminal timg %
]])
If you are using vim script, you should remove the first and last line.
This code will create an auto command that will run whenever a Buffer is shown. Use it just to preview images from time to time, since it will reload the preview every time you enter the buffer and that might be a little heavy on the system.
I'm new to neovim scripting, so if you see a problem or know how to improve it, please send me a message 🙂