mirror of
https://github.com/LukeSmithxyz/voidrice.git
synced 2026-03-20 01:37:45 +01:00
bulkrename using bult-ins instead of using a completely separate program
This commit is contained in:
parent
991b052a55
commit
4cd9c62c93
@ -93,7 +93,26 @@ cmd copyto ${{
|
||||
}}
|
||||
|
||||
cmd setbg "$1"
|
||||
cmd bulkrename $vidir
|
||||
|
||||
cmd bulkrename ${{
|
||||
old="$(mktemp)"
|
||||
new="$(mktemp)"
|
||||
[ -z "$fs" ] && fs="$(ls)"
|
||||
printf '%s\n' "$fs" >"$old"
|
||||
printf '%s\n' "$fs" >"$new"
|
||||
$EDITOR "$new"
|
||||
[ "$(wc -l < "$new")" -ne "$(wc -l < "$old")" ] && exit
|
||||
paste "$old" "$new" | while IFS= read -r names; do
|
||||
src="$(printf '%s' "$names" | cut -f1)"
|
||||
dst="$(printf '%s' "$names" | cut -f2)"
|
||||
if [ "$src" = "$dst" ] || [ -e "$dst" ]; then
|
||||
continue
|
||||
fi
|
||||
mv -- "$src" "$dst"
|
||||
done
|
||||
rm -- "$old" "$new"
|
||||
lf -remote "send $id unselect"
|
||||
}}
|
||||
|
||||
# Bindings
|
||||
map <c-f> $lf -remote "send $id select \"$(fzf)\""
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user