Skip to content

Instantly share code, notes, and snippets.

@nick133
Created May 4, 2022 21:28
Show Gist options
  • Save nick133/dd260510bfbe8c38bdf17dd2202144eb to your computer and use it in GitHub Desktop.
Save nick133/dd260510bfbe8c38bdf17dd2202144eb to your computer and use it in GitHub Desktop.
Excellent nnn filemanager related config from ~/.bashrc
# https://linux.101hacks.com/cd-command/cdpath/
export CDPATH=~/.config/nnn/bookmarks
if [[ "$XDG_SESSION_TYPE" == "tty" ]]
then
export GUI=0
export BROWSER=elinks
else
export GUI=1
export BROWSER=firefox
fi
export EDITOR=vim
export VISUAL=vim
export PAGER=less
export NNN_BMS="d:$HOME/Downloads;c:$HOME/Documents;t:$HOME/.local/tmp;v:$HOME/.vim;f:$HOME/.config"
export NNN_OPTS='acdEfHoQrUx'
export NNN_OPENER='ufo'
NNN_PLUG='d:bookmarks;f:finder;o:-pkgowns;i:to-utf8;'
NNN_PLUG+='b:-!hexdump -C "$nnn"|less*;'
NNN_PLUG+='v:-!less "$nnn"*;'
NNN_PLUG+='h:-!dhex "$nnn"*;'
NNN_PLUG+='m:-!fumenu;'
NNN_PLUG+='u:-!clear&&grc du -sxh "./$nnn";'
export NNN_PLUG
export NNN_ARCHIVE="\\.(7z|bz2|gz|tar|tgz|zip|zst|xz|rar)$"
export NNN_COLORS='#e27621c4e27621c4'
export NNN_FCOLORS='c1e23f2e006033f7c6d6abc4'
export NNN_MCLICK="$(tput cr)"
export NNN_TMPFILE='/tmp/nnn-lastdir.tmp'
#export NNN_HELP='cowsay Hello'
export sel="$HOME/.config/nnn/.selection"
n() {
[[ "$XDG_SESSION_TYPE" != "tty" ]] && echo -e "\033]0;${TERM}: nnn\007"
if [[ "$NNNLVL" ]]
then
echo -e "*** Warning: NNN is already running! ***"
exit 1
else
nnn -Tv $@
fi
[[ -r $NNN_TMPFILE ]] && {
source $NNN_TMPFILE
rm -f $NNN_TMPFILE
}
}
x() { [[ -n "$NNNLVL" ]] && exit 0; }
xx() { exit 0; }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment