Preview Images with image.vim

Sometimes I accidentally open a png or jpg with Vim, and it shows me a face-melting representation of the binary data. If you do this enough it gets annoying, so instead I've been using Ashish Anand's image.vim to render ASCII previews of images.


Converting images to ASCII is an old trick that you can do pretty easily on the command-line (at least it's easy in Linux), but the thing I liked about this plugin is it uses an autocmd to run whenever an image is opened:

au BufRead *.png,*.jpg,*.jpeg :call DisplayImage()

It uses the Python Imaging Library (pip install Pillow) to render the ASCII image, which you may find easier to install than the equivalent command-line tools.

blog comments powered by Disqus