move lf configuration and use upstream
This commit is contained in:
parent
67cb4995f9
commit
f3685dcbf5
5 changed files with 156 additions and 165 deletions
22
home/programs/lf/bulk-rename.sh
Normal file
22
home/programs/lf/bulk-rename.sh
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
|
||||
old="$(mktemp)"
|
||||
new="$(mktemp)"
|
||||
if [ -n "$fs" ]; then
|
||||
fs="$(basename -a $fs)"
|
||||
else
|
||||
fs="$(ls)"
|
||||
fi
|
||||
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"
|
||||
Loading…
Add table
Add a link
Reference in a new issue