NNN terminal file-manager

Non release banter
Post Reply
User avatar
M. Eerie
Shogun
Shogun
Posts: 428
Joined: 31 Aug 2017, 21:18
Distribution: Nemesis Xfce x64

NNN terminal file-manager

Post#1 by M. Eerie » 22 May 2021, 10:44

From the same author of buku (terminal bookmark manager), comes nnn terminal file-manager.

At first glance, it seems pretty similar to ranger, lf and the like, but nnn is just a 125Kb binary (1,5 Mb if you want pretty icons) written in C that you can compile by yourself in no time because it has very few dependencies, or just grab a precompiled binary.

Image

The result is a full-featured and blazing fast program, extensible by simple plugins that can be written in any scripting language.

This is a Quickstart to nnn.

Watch some videos.

Even though this poses a major change in the usual file managing workflow/habits, I hope you find it useful and I'm sure once you get used to it, you won't regret it.
> Does not compute_ 🖖

User avatar
Rava
Contributor
Contributor
Posts: 3268
Joined: 11 Jan 2011, 02:46
Distribution: XFCE 5.0rc3 x86_64 + 4.0 i586
Location: Forests of Germany
Contact:

NNN terminal file-manager

Post#2 by Rava » 18 Nov 2021, 22:24

M. Eerie wrote:
22 May 2021, 10:44
The result is a full-featured and blazing fast program, extensible by simple plugins that can be written in any scripting language.
The default colour scheme seems to go bad with xfce4-terminal: trying to read dark blue text on black background is a hard task. :(
Maybe it needs a custom setup to work better in XFCE.
I made my module from nnn-4.0-1.el8.0.centos.x86_64.rpm and it works okay in 5.0rc3:
https://filehorst.de/download.php?file=eEhekslF
md5sum 82d5c0304bb2fc91889935a1b2865ba4

Added in 7 hours 12 minutes 31 seconds:
You get lots of info with the usual -help (--help gets an error) e.g.

Code: Select all

root@porteus:/mnt/live/memory/images# nnn -help|grep color
 -C      earlier colorscheme
 -D      dirs in context color
or

Code: Select all

root@porteus:~# nnn -help|grep hidden
 -H      show hidden files
and the "?" key when you are in nnn is very helpful for nnn noobs since it shows the keybinds. :)
Cheers!
Yours Rava

User avatar
M. Eerie
Shogun
Shogun
Posts: 428
Joined: 31 Aug 2017, 21:18
Distribution: Nemesis Xfce x64

NNN terminal file-manager

Post#3 by M. Eerie » 19 Nov 2021, 08:02

Rava wrote:
19 Nov 2021, 05:37
The default colour scheme seems to go bad with xfce4-terminal
There's a trick to even allow for NNN "themes" :)
You need to define 12 colors based on this table, each of which is associated with the following elements:
#BLK-CHR-DIR-EXE-REG-HARDLINK-SYMLINK-MISSING-ORPHAN-FIFO-SOCK-OTHER

Image

This is my .nnnrc under my /home/guest dir.

Code: Select all

n ()
{
# REVIEW:
# https://www.linuxlinks.com/excellent-system-tools-nnn-portable-terminal-file-manager/5/
#
    # Block nesting of nnn in subshells
    if [ -n $NNNLVL ] && [ "${NNNLVL:-0}" -ge 1 ]; then
        echo "nnn is already running"
        return
    fi

    # The default behaviour is to cd on quit (nnn checks if NNN_TMPFILE is set)
    # To cd on quit only on ^G, remove the "export" as in:
    #     NNN_TMPFILE="${XDG_CONFIG_HOME:-$HOME/.config}/nnn/.lastd"
    # NOTE: NNN_TMPFILE is fixed, should not be modified
    export NNN_TMPFILE="${XDG_CONFIG_HOME:-$HOME/.config}/nnn/.lastd"

    # Unmask ^Q (, ^V etc.) (if required, see `stty -a`) to Quit nnn
    # stty start undef
    # stty stop undef
    # stty lwrap undef
    # stty lnext undef

    nnn -Hax "$@"

    if [ -f "$NNN_TMPFILE" ]; then
            . "$NNN_TMPFILE"
            rm -f "$NNN_TMPFILE" > /dev/null
    fi
}

[ -n "$NNNLVL" ] && PS1="N$NNNLVL $PS1"
alias ncp="cat ${NNN_SEL:-${XDG_CONFIG_HOME:-$HOME/.config}/nnn/.selection} | tr '\0' '\n'"

# PLUGINS
# curl -Ls https://raw.githubusercontent.com/jarun/nnn/master/plugins/getplugs | sh 
#

### THEMES
#BLK-CHR-DIR-EXE-REG-HARDLINK-SYMLINK-MISSING-ORPHAN-FIFO-SOCK-OTHER
#NORD='0B0B04060006060009060B06'
#ONEDARK='0404040000000600010F0F02'
#PLAIN='00004B230000000000000000'
#DEFAULT_VARIATION='C1E2272E006033F7C6D6ABC4'
#DEFAULT_THEME='C1E24B23006033F7C6D6ABC4'
### THEMES.

export NNN_ARCHIVE="\\.(7z|a|ace|alz|arc|arj|bz|bz2|cab|cpio|deb|gz|jar|lha|lz|lzh|lzma|lzo|rar|rpm|rz|t7z|tar|tbz|tbz2|tgz|tlz|txz|tZ|tzo|war|xpi|xz|Z|zip)$"
export NNN_MCLICK='^R'
export NNN_SEL='~/.config/nnn/.selection'
export NNN_RCLONE='rclone mount --read-only'
export NNN_SSHFS='sshfs -o reconnect,idmap=user'
export NNN_COLORS='#0a1b2c3d' # '5236' (/'#0a1b2c3d'/'#0a1b2c3d;1234')
export NNN_FCOLORS='C1E24B23006033F7C6D6ABC4'
export NNN_PLUG='c:fzcd;d:diffs;f:finder;o:fzopen;m:nmount;n:nuke;x:togglex;p:preview-tui;i:imgviu;t:imgthumb;v:vidthumb'
export NNN_BMS='h:~;E:~/Desktop;d:~/Documents;w:~/Downloads;p:~/Pictures/;v:~/Videos'
export EDITOR='pluma'
export NNN_USE_EDITOR="$EDITOR"
#export NNN_FIFO='/tmp/nnn.fifo'
#export NNN_OPENER=~/.config/nnn/plugins/nuke
#export NNN_TRASH=1
Also, you can use xfce4-terminal "themes". There's plenty of them.
You put them in
~/.config/xfce4/terminal/colorschemes

I.e., this is the one I'm using ~/.config/xfce4/terminal/colorschemes/my-Argonaut.theme:

Code: Select all

; ColorBoldIsBright=FALSE
[Scheme]
Name=my-Argonaut
ColorForeground=#f2f2f2
ColorBackground=#0c0c0c
ColorCursor=#f2f2f2
ColorCursorUseDefault=FALSE
ColorPalette=#232323;#cc0000;#4e9a06;#ffb900;#396bd7;#b449be;#66ccff;#cccccc;#555555;#ff2740;#abe15b;#ffd242;#709aed;#db67e6;#99eeff;#eeeeee
Greetings_
> Does not compute_ 🖖

Post Reply