From 7d9d73992489203d690c8d549386c71bbcebd330 Mon Sep 17 00:00:00 2001 From: Luca Bilke Date: Sun, 31 Jul 2022 13:15:03 +0200 Subject: [PATCH] use rsync for paste, add 0x0 sharing keybind --- .config/lf/lfrc | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/.config/lf/lfrc b/.config/lf/lfrc index a1381f1ef..6e49c8584 100644 --- a/.config/lf/lfrc +++ b/.config/lf/lfrc @@ -148,18 +148,37 @@ cmd on-cd &{{ lf -remote "send $id set promptfmt \"$fmt\"" }} -cmd paste $cp-p --lf-paste $id +cmd paste &{{ + set -- $(cat ~/.local/share/lf/files) + mode="$1" + shift + case "$mode" in + copy) + rsync -av --ignore-existing --progress -- "$@" . | + stdbuf -i0 -o0 -e0 tr '\r' '\n' | + while IFS= read -r line; do + lf -remote "send $id echo $line" + done + ;; + move) mv -n -- "$@" .;; + esac + rm ~/.local/share/lf/files + lf -remote "send clear" +}} + +cmd share $curl -F"file=@$fx" https://0x0.snaile.de | xclip -selection c # Bindings map $lf -remote "send $id select '$(fzf)'" map J $lf -remote "send $id cd $(sed -e 's/\s*#.*//' -e '/^$/d' -e 's/^\S*\s*//' ${XDG_CONFIG_HOME:-$HOME/.config}/shell/bm-dirs | fzf)" map D trash -# map D delete +map delete map E extract map C copyto map R rsyncto map M moveto map P link +map S share map push :mkdir map reload