1
0
Fork 0

lf: fix dupe keybind

This commit is contained in:
Luca Bilke 2024-09-26 18:25:34 +02:00
parent 53d66d0a2f
commit d19ef643d4
2 changed files with 3 additions and 6 deletions

View file

@ -104,11 +104,9 @@ cmd paste &{{
cmd dupe &{{
for file in $fx; do
find "$PWD" "$file" -maxdepth 0 | grep -oP '(?<=.\.~)\d+(?=~$)' | sort -n | tail -1 | (
ext=$(($(cat /dev/stdin)+1))
filedest="$(echo "$file" | sed 's/.~[[:digit:]]*~$//').~$ext~"
cp -r "$file" "$filedest"
)
basename=$(basename "$file" | sed 's/\.~[0-9]*~$//')
target=$(fd -gud1 "*$basename*" "$PWD" | sort -V | awk -F '~' 'END { sub(/(\.~[0-9]*~){0,1}$/, (".~" $(NF-1)+1 "~")); print }')
cp -a "$file" "$target"
done
}}

View file

@ -9,4 +9,3 @@ context.work.write=+work
include /usr/share/doc/task/rc/dark-16.theme
include /usr/share/doc/task/rc/holidays.de-DE.rc
context=work