summaryrefslogtreecommitdiffstats
path: root/.config/lf
diff options
context:
space:
mode:
Diffstat (limited to '.config/lf')
-rw-r--r--.config/lf/lfrc22
1 files changed, 21 insertions, 1 deletions
diff --git a/.config/lf/lfrc b/.config/lf/lfrc
index d1c9402..25fb3d1 100644
--- a/.config/lf/lfrc
+++ b/.config/lf/lfrc
@@ -93,7 +93,27 @@ cmd copyto ${{
}}
cmd setbg "$1"
-cmd bulkrename $vidir
+
+cmd bulkrename ${{
+ tmpfile_old="$(mktemp)"
+ tmpfile_new="$(mktemp)"
+
+ [ -n "$fs" ] && fs=$(basename -a $fs) || fs=$(ls)
+
+ echo "$fs" > "$tmpfile_old"
+ echo "$fs" > "$tmpfile_new"
+ $EDITOR "$tmpfile_new"
+
+ [ "$(wc -l < "$tmpfile_old")" -eq "$(wc -l < "$tmpfile_new")" ] || { rm -f "$tmpfile_old" "$tmpfile_new"; exit 1; }
+
+ paste "$tmpfile_old" "$tmpfile_new" | while IFS="$(printf '\t')" read -r src dst
+ do
+ [ "$src" = "$dst" ] || [ -e "$dst" ] || mv -- "$src" "$dst"
+ done
+
+ rm -f "$tmpfile_old" "$tmpfile_new"
+ lf -remote "send $id unselect"
+}}
# Bindings
map <c-f> $lf -remote "send $id select \"$(fzf)\""