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.
- 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.
2. Preview pdfs
Displaying pdfs is a little bit complicated, and I first try to use the
sipsfunction 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.
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!