Member-only story

Preview Pictures, PDFs and Videos in vifm

Jake Jing
4 min readJul 31, 2020

It takes a while for me to figure out how you can preview pictures and pdfs in vifm on Kitty terminal. I tried many different utilities, such as w3m and überzug, but the displayed pictures are not satisfying or it is really a pain to deploy the environments on my MacBook.

I recently find that Kitty can support image display in the terminal via icat function (tested on kitty v0.24.2 & vifm 0.12). To make it work, you first need to install ImageMagick. See the Kitty webpage for details, and a tutorial for the configuration of kitty and vifm on your computer. This also works well when you need to switch between different panels.

You can test icat function via the following command:

kitty +kitten icat --place=10x10@0x0 image.png

Note: I recently got the following error ‘/dev/tty’ is not configured or no such device in kitty. You can try to install the latest vifm in git repository and the following settings should solve the problem now.

git clone https://github.com/vifm/vifm.git
cd vifm
./configure
make
make install
mv src/vifm /usr/local/bin/

1. Preview pictures

To preview the pictures, you need to configure the fileview for pictures in your “vifmrc” by replacing the default setting with the codes below.

Preview pictures in vifm

2. Preview pdfs

  • Method 1 with pdftoppm (Best Solution)

I have experienced different ways of previewing pdfs in vifm. The general idea is that we can extract the first page of the pdf and use icat to display it as a image. Here I am using pdftoppm function from poppler package to print out the first page as stdout, and then use icatto read the image from the stdin (— transfer-mode=stream). This is more efficient than the other two approaches below.

brew install poppler

Create an account to read the full story.

The author made this story available to Medium members only.
If you’re new to Medium, create a new account to read this story on us.

Or, continue in mobile web

Already have an account? Sign in

Jake Jing
Jake Jing

Written by Jake Jing

Programming, Data science & Deep learning!

Responses (3)

Write a response