From a863c733473a5ae47a4481cdd402da323f2d0da4 Mon Sep 17 00:00:00 2001 From: Klesh Wong Date: Fri, 5 Mar 2021 11:56:56 +0800 Subject: [PATCH] [feature] capital P for paste-overwrite --- cli/lf/lfrc | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/cli/lf/lfrc b/cli/lf/lfrc index 0f68500..cd43a86 100644 --- a/cli/lf/lfrc +++ b/cli/lf/lfrc @@ -3,7 +3,21 @@ set icons cmd mkdir %mkdir "$@" cmd copyfilepath %echo "$f" | xsel -b -cmd copyfilename %basename "$f" | xsel -b - map Yp copyfilepath + +cmd copyfilename %basename "$f" | xsel -b map Yn copyfilename + +cmd pasteoverwrite %{{ + load=$(lf -remote 'load') + mode=$(echo "$load" | sed -n '1p') + list=$(echo "$load" | sed '1d') + if [ $mode = 'copy' ]; then + cp -R $list . + elif [ $mode = 'move' ]; then + mv $list . + fi + lf -remote 'send load' + lf -remote 'send clear' +}} +map P pasteoverwrite