DEV Community

Md. Tasnim Alam
Md. Tasnim Alam

Posted on

How to enable image preview in nnn with kitty terminal

NNN is a very fast, minimal terminal-based file manager. You can easily navigate, manipulate files in the command line, and much more. If you're a terminal user, you should check this out. It'll supercharge your productivity to another level.

Zsh/Bash/Fish config

You need to set a NNN_FIFO path and a key for the plugin with NNN_PLUG. I'm using "p" key to see the preview.

For zsh/bash users, copy this line into .bashrc or .zshrc

export NNN_FIFO="/tmp/nnn.fifo"
export NNN_PLUG="p:preview-tui"

For fish users, put this into config.fish file

set --export NNN_FIFO "/tmp/nnn.fifo"
set -x NNN_PLUG "p:preview-tui"

Kitty config

Open kitty config file ( ~/.config/kitty/kitty.conf ), find and change these variables:

allow_remote_control yes
listen_on unix:$TMPDIR/kitty
enabled_layouts all

That's it. Now, open nnn in a terminal and hover over an image file. Press 'p and see the preview of the image. You can change the split position by changing enabled_layout variable in kitty.conf

Top comments (0)