dotfiles/data/home/.config/nnn.sh
2024-06-18 03:14:30 +02:00

44 lines
867 B
Bash

# more at https://github.com/jarun/nnn/wiki/Usage#configuration
# plugin list
export NNN_PLUG="p:preview-tui;x:!chmod +x $nnn"
# Colors
export NNN_FCOLORS="0000DE000000000000000000"
# 1 2 3 4 5 6 7 8 9101112
# 1 - block device
# 2 - char device
# 3 - directory
# 4 - executables
# 5 - regular
# 6 - hard link
# 7 - symbolic link
# 8 - missing info
# 9 - invalid link
#10 - fifo
#11 - socket
#12 - unknown
# FIFO file
export NNN_FIFO="/tmp/nnn.fifo"
# preview at startup
alias nnn="/usr/bin/nnn -P p -d"
# cd on quit
n ()
{
if [ -n $NNNLVL ] && [ "${NNNLVL:-0}" -ge 1 ]; then
echo "nnn is already running"
return
fi
export NNN_TMPFILE="${XDG_CONFIG_HOME:-$HOME/.config}/nnn/.lastd"
nnn "$@"
if [ -f "$NNN_TMPFILE" ]; then
. "$NNN_TMPFILE"
rm -f "$NNN_TMPFILE" > /dev/null
fi
}