Preview Pictures, PDFs and Videos in vifm

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. 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.

  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

Displaying pdfs is a little bit complicated, and I first try to use thesipsfunction to extract and save the first page into picture (.jpg) in a temporary folder. Next, I can use the icatfunction to preview the picture. You can replace the default setting in your “vifmrc” file with the following code chunk.

Preview pdfs in vifm

3. Preview videos

In order to preview videos in vifm, I am using the ffmpeg package to extract the first video frame, and save it as a picture in the /tmp/ directory. With this, you can view at least the beginning of the video. Note that I added the *.gif in the list, so that it can also support the preview of gif files. Please insert the following code chunk in your “vifmrc”, and restart the terminal. Everything should work well now!

Preview videos in vifm

Programming, Data analysis & Deep learning!

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store