diff options
author | Yaroslav de la Peña Smirnov <yps@yaroslavps.com> | 2023-06-19 16:11:17 +0300 |
---|---|---|
committer | Yaroslav de la Peña Smirnov <yps@yaroslavps.com> | 2023-06-19 16:11:17 +0300 |
commit | 40ae4113618bd39269fdf7a3598a6d1530c0efc7 (patch) | |
tree | 4231103352d7e20016b5034ebb1622d19ad062e9 /dotfiles/.config/lf | |
parent | d61c315dd49116d8c3823e48a30924eb8c66c14f (diff) | |
download | swayrice-40ae4113618bd39269fdf7a3598a6d1530c0efc7.tar.gz swayrice-40ae4113618bd39269fdf7a3598a6d1530c0efc7.zip |
lf: change way to paste files
* Modified the default paste command to use rsync
* Added an archive command to paste with rsync with archive flag set
(preserve dates, permissions, ownership, etc.)
Diffstat (limited to 'dotfiles/.config/lf')
-rw-r--r-- | dotfiles/.config/lf/lfrc | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/dotfiles/.config/lf/lfrc b/dotfiles/.config/lf/lfrc index 10a2952..f88c562 100644 --- a/dotfiles/.config/lf/lfrc +++ b/dotfiles/.config/lf/lfrc @@ -93,6 +93,50 @@ cmd soft_link %{{ ln -s $list . }} +cmd paste &{{ + set -- $(cat ~/.local/share/lf/files) + mode="$1" + shift + case "$mode" in + copy) + rsync -rlDvh --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 -- "$@" . + lf -remote "send $id clear" + ;; + esac + lf -remote "send $id reload" +}} + +cmd archive &{{ + set -- $(cat ~/.local/share/lf/files) + mode="$1" + shift + case "$mode" in + copy) + rsync -avhH --delete --progress -- "$@" . | + stdbuf -i0 -o0 -e0 tr '\r' '\n' | + while IFS= read -r line; do + lf -remote "send $id echo $line" + done + ;; + move) + rsync -avhH --delete --remove-source-files --progress -- "$@" . | + stdbuf -i0 -o0 -e0 tr '\r' '\n' | + while IFS= read -r line; do + lf -remote "send $id echo $line" + done + lf -remote "send $id clear" + ;; + esac + lf -remote "send $id reload" +}} + # Bindings map A rename map c @@ -117,6 +161,7 @@ map Y :yank-path map L $LESSOPEN='| ~/.local/bin/scope %s' less -r $f # open file preview in pager map P hard_link map <a-p> soft_link +map r archive # Mouse bindings map <m-3> :dragon |