This commit is contained in:
2026-03-30 17:38:45 +09:00
commit 29e2149d66
20 changed files with 677 additions and 0 deletions

10
.local/bin/git-ci Executable file
View File

@@ -0,0 +1,10 @@
#!/bin/bash
if [ $# -eq 0 ]; then
git commit -v
else
if [ "$1" = "--amend" ]; then
git commit -v --amend
else
git commit -m "$*"
fi
fi

7
.local/bin/git-orphan Executable file
View File

@@ -0,0 +1,7 @@
#!/bin/bash
git checkout --orphan temp
git add -A
git commit -m "init"
git branch -D main
git branch -m temp main
git push -f origin main

65
.local/bin/vren Executable file
View File

@@ -0,0 +1,65 @@
#!/bin/zsh
# vren - rename files with vim
# usage: vren [dir]
dir="${1:-.}"
cd "$dir" || exit 1
# git init if no .git
has_git=0
if [ -d .git ]; then
has_git=1
else
git init -q
git add -A
git commit -q -m "before rename"
fi
# list files
old=$(mktemp)
new=$(mktemp)
ls -1 > "$old"
cp "$old" "$new"
# edit
vim "$new"
# check
old_count=$(wc -l < "$old")
new_count=$(wc -l < "$new")
if [ "$old_count" -ne "$new_count" ]; then
echo "error: line count mismatch ($old_count -> $new_count)"
rm "$old" "$new"
exit 1
fi
# diff
changes=0
paste "$old" "$new" | while IFS=$'\t' read -r o n; do
[ "$o" != "$n" ] && echo " $o -> $n" && changes=$((changes+1))
done
if ! diff -q "$old" "$new" >/dev/null 2>&1; then
echo ""
printf "apply? (y/n): "
read -q ans
echo ""
if [ "$ans" = "y" ]; then
paste "$old" "$new" | while IFS=$'\t' read -r o n; do
[ "$o" != "$n" ] && mv -- "$o" "$n"
done
echo "done"
# restore point
if [ "$has_git" -eq 0 ]; then
git add -A
git commit -q -m "after rename"
echo "restore: git log / git checkout HEAD~1 -- ."
fi
else
echo "cancelled"
fi
else
echo "no changes"
fi
rm "$old" "$new"

Binary file not shown.