APC Australia

Plugins for nnn

-

Nnn is tiny but highly extensible. There are several plugins available in the Git repo (check out the list at https://github.com/jarun/nnn/tree/

master/plugins, which also shows their dependenci­es), and even a script to install them easily. You can run this script directly (but even though it runs as your user it’s good practice to check it first) with curl -Ls https://raw.githubuser­content.com/jarun/nnn/master/ plugins/getplugs | sh

This will install all the plugins in ~/.config/nnn/plugins. To use them we list them in the NNN_PLUG environmen­t variable, together with a hotkey to invoke them. For example if you’ve got the mediainfo tool installed ( sudo apt install mediainfo ), invoke the mediainf plugin (which requires $PAGER to be set too) with:

export PAGER=less

export NNN_PLUG=’m:mediainf’

then start nnn as normal. Now find a media file, hit ; to enter plugin mode, then hit m and you’ll see media informatio­n. You can make these variables persistent by appending them to your ~/.bashrc file. To use multiple plugins, delimit them with semicolons.

You can write your own plugins in whatever language you like, but for reasons of purity POSIX-compliant shell scripts are preferred. Have a look at the provided ones to learn the ropes. Some of them are quite fun – who would’ve thought we’d finish this issue reading Gargantua and Pantagruel in a terminal file manager, via Project Gutenberg?

Newspapers in English

Newspapers from Australia