diff --git a/.README.md b/.README.md index 808d219..13bff07 100644 --- a/.README.md +++ b/.README.md @@ -175,3 +175,40 @@ cd $HOME nvim --version vi --version ``` + +## nnn — n³ + +### Dependencies + +- kitty / NerdFont + +- Archives Management: + - bsdtar (`libarchive-tools`) supports _Zstd_ + - last release of `atool` is from 2012 + - https://github.com/solsticedhiver/atool2 + - https://github.com/wummel/patool + +- Drag&Drop: URI=https://github.com/mwh/dragon + +- Trash: + - `trash-cli` is a much better CLI-only solution! + Compare the outputs of `trash-cli` and `gio trash --list`… + - For `gio trash`, packages `libglib2.0` & `gvfs` are recommended. + +### Source Code of Latest Release + +``` +# Download archive & extract files +URI=https://github.com/jarun/nnn +xdg-open $URI/releases/latest +ARCHIVE=$(echo $HOME/Downloads/*.gz(om[1])) && echo $ARCHIVE +tar xf $ARCHIVE + +# Compile +cd nnn*(om[1]) +make clean +sudo make O_GITSTATUS=1 O_NAMEFIRST=1 O_NERD=1 install + +# Copy plugins +plugins/getplugs +``` diff --git a/.zshrc b/.zshrc index c9fd4f7..1a00461 100644 --- a/.zshrc +++ b/.zshrc @@ -194,7 +194,7 @@ alias llt='lsd -ltrA' alias lx='lsd -l --blocks=permission,user,group,context,size,date,name' alias llx='lx -A' -alias tree='lsd --long --tree --depth=2 --no-symlink' +alias t='lsd --long --tree --depth=2 --no-symlink' # Dev # @@ -226,6 +226,36 @@ compdef hg=rg # To choose an existing instance for nvr, use: # `export NVIM=$(nvr --serverlist | fzf --exit-0 --select-1) && echo $NVIM` +# nnn - n³ +# +# See https://github.com/jarun/nnn/wiki/Usage#configuration +export NNN_ARCHIVE='\\.(7z|bz2|gz|tar|tbz|tgz|xz|zip|zst)$' +export NNN_BMS="d:$HOME/Downloads" +export NNN_OPTS='ABin' +export NNN_ORDER="t:$HOME/Downloads" +export NNN_PLUG="d:diffs;D:dragdrop;M:xdgdefault" +if (( ${+commands[trash-put]} )); then + export NNN_TRASH=1 +elif (( ${+commands[gio]} )); then + export NNN_TRASH=2 +fi + +n() +{ + if [ ${NNNLVL:-0} -gt 0 ]; then + echo 'nnn is already running' + return + fi + + LESS=${LESS/F} + command nnn "$@" + + NNN_TMPFILE="${XDG_CONFIG_HOME:-$HOME/.config}/nnn/.lastd" + if [ -f $NNN_TMPFILE ]; then + . $NNN_TMPFILE + rm -f $NNN_TMPFILE > /dev/null + fi +} ### ### Aliases -- Global & automatic expansion