]> Sergey Matveev's repositories - dotfiles.git/commitdiff
Let's try nnn
authorSergey Matveev <stargrave@stargrave.org>
Tue, 24 Oct 2023 13:57:01 +0000 (16:57 +0300)
committerSergey Matveev <stargrave@stargrave.org>
Tue, 24 Oct 2023 14:53:01 +0000 (17:53 +0300)
nnn/.zsh/env/005nnn.zsh [new file with mode: 0644]
nnn/bin/_nnn-cd [new file with mode: 0755]
nnn/bin/_nnn-cp [new file with mode: 0755]
zsh/.zsh/rc/010aliases.zsh

diff --git a/nnn/.zsh/env/005nnn.zsh b/nnn/.zsh/env/005nnn.zsh
new file mode 100644 (file)
index 0000000..256d42d
--- /dev/null
@@ -0,0 +1,4 @@
+export NNN_OPTS=dHRU
+export NNN_OPENER=zsh-mime-open
+export NNN_PLUG='s:!sxiv -t .*;p:!_nnn-cp;a:!tar tf "$nnn" | less*;c:!_nnn-cd*;C:!_nnn-cd /*'
+export NNN_ARCHIVE="\\.(bz2|gz|tar|tgz|txz|xz|zip|zst)$"
diff --git a/nnn/bin/_nnn-cd b/nnn/bin/_nnn-cd
new file mode 100755 (executable)
index 0000000..042efe7
--- /dev/null
@@ -0,0 +1,7 @@
+#!/usr/bin/env zsh
+
+set -e
+[[ -n "$NNN_PIPE" ]]
+autoload ~/.zsh/functions/cf
+cf $1
+print -n -- "0c$PWD" > "$NNN_PIPE"
diff --git a/nnn/bin/_nnn-cp b/nnn/bin/_nnn-cp
new file mode 100755 (executable)
index 0000000..ca733b4
--- /dev/null
@@ -0,0 +1,12 @@
+#!/usr/bin/env zsh
+
+set -e
+sel=${NNN_SEL:-${XDG_CONFIG_HOME:-$HOME/.config}/nnn/.selection}
+[[ -s $sel ]]
+read -d $"\x00" -A tgts < $sel || :
+size=$(du -A -c $tgts)
+size=(${=size})
+size=${size[$#size - 1]}
+for tgt ($tgts) ( cd $tgt:h ; tar cf - $tgt:t ) |
+pv --wait --interval 0.5 --size ${size}k |
+tar xf - --options read_concatenated_archives
index 1e21fdae32e54480f50dde6ced9d34b57d7d9cd2..709376d5532c0c967e82353722de931bc6340278 100644 (file)
@@ -8,4 +8,5 @@ alias -g W="| wc -l | sed 's/ //g'"
 alias l="ls -AF, "
 alias ll="ls -D \"%Y-%m-%d %H:%M\" -AFl, "
 alias mc="mc --nomouse --nosubshell"
+alias NN="nnn"
 alias vi="vim"