Use Nerd Icons With NNN File Manager

Objective

Compile nnn file manager on Arch Linux or another Linux based distribution. Display Nerd Font icons.

Difficulty

Advanced-ish

Prerequisites

  • Linux Installation. (I will use Arch for this example)
  • xorg/Window Manager. (I will use i3 for this example)
  • A terminal emulator. (I will use Alacritty for this example)
  • Text Editor. (I use Micro, highly recommend for quick edits in terminal)
  • git (for downloading nnn)

Steps

1. Install a Nerd-Font and Configure Your Terminal Editor :

A.) Before downloading nnn you’ll want to make sure you have a Nerd-Font installed on your system. You also need to be sure that your terminal emulator is configured to use the Nerd-font.

Alacritty with DaddyTimeMono NF

Notes:

  • If you want to manually install a Nerd-Font you can look at my post here.
  • If you want an example of how to change the config file in Alacritty you can look at this post.
  • Refer to the documentation for your specific terminal emulator to be sure that it is configured properly.
  • Be sure that your locale settings are configured correctly before starting.

2. Download NNN:

We’re going to download the nnn source from Github, so you’ll want to either navigate to or create a directory to hold downloaded files. Most will already have a Downloads directory created in their home folder:

cd ~/Downloads

or to create from the home directory:

mkdir Downloads

once you are in the directory you want run:

git clone https://github.com/jarun/nnn.git

to clone the nnn source files to that directory:

3. Make and Test:

Once downloaded you will want to compile nnn from the newly downloaded directory. If you want to use Nerd-Font Icons you need to include the O_NERD=1 flag in your make command (the letter O). You will also need root privileges:

cd ~/Downloads/nnn
sudo make O_NERD=1

to test that it worked you can run the compiled binary within the directory you are still in:

./nnn

You should now see this:

nnn with Nerd-Font icons and DaddyTimeMono patched Nerd-Font

Uh oh! If you see something like this it means your compile worked but you need to configure your locale settings:

I have a post here that will walk you through setting it on Arch Linux, or see the Arch-Wiki: locale. If you’re on another distribution refer to the documentation on how to set your locale to UTF-8.

Notes:

  • Dependencies for nnn should already be on most Linux distros out of the box. If you see any errors (such as a file can’t be found) during compile, double-check that you have all the required dependencies: nnn/install and recompile.
  • If you’re on Arch Linux, There are pre-built packages for Nerd-Font and Icons-in-Terminal on the AUR.

4. Move the compiled executable.

Once you have everything working correctly you can use this command to copy the compiled executable to /bin/:

sudo mv ~/Downloads/nnn/nnn /bin/ 

where ‘~/Downloads/nnn/nnn’ is the path to your executable. This will make nnn available globally on your terminal when you run the command ‘nnn’.

If your on a distribution other than Arch refer to the documentation to double check the preferred location for executable files.

[top][home]