From 0ca53be167a7c5d711b668074501b43362848460 Mon Sep 17 00:00:00 2001 From: Alex Karle Date: Wed, 31 Aug 2022 10:25:00 -0400 Subject: [PATCH] acme: Add `Note` script, `gv` for current file history Note is a nice way to just jot down some thoughts in my notes repo. It starts a new buffer with a default name and a date for the note, making it easy to edit the name before a Put. While reviewing a PR in acme, I found I wanted per-file git log history, which is what gv is! I've also modified gbl to blame the current file, if no argument is given, which is much easier than having to pass an arg. --- bin/acme-scripts/Note | 3 +++ bin/acme-scripts/gbl | 7 +------ bin/acme-scripts/glo | 2 +- bin/acme-scripts/gls | 2 +- bin/acme-scripts/gv | 4 ++++ 5 files changed, 10 insertions(+), 8 deletions(-) create mode 100755 bin/acme-scripts/Note create mode 100755 bin/acme-scripts/gv diff --git a/bin/acme-scripts/Note b/bin/acme-scripts/Note new file mode 100755 index 0000000..585406f --- /dev/null +++ b/bin/acme-scripts/Note @@ -0,0 +1,3 @@ +#!/bin/sh +name=${1:-scratch-$(/usr/bin/date +%F).txt} +(date; echo) | plumb -i -d edit -a "action=showdata filename=$HOME/notes/$name" diff --git a/bin/acme-scripts/gbl b/bin/acme-scripts/gbl index 7f3a319..9a54274 100755 --- a/bin/acme-scripts/gbl +++ b/bin/acme-scripts/gbl @@ -1,9 +1,4 @@ #!/bin/sh # git blame, in acme! -if [ -z "$1" ]; then - echo "usage: gbl FILE" 1>&2 - exit 1 -fi - -file=$1 +file=${1:-$samfile} git blame --date="short" "$file" | plumb -i -d edit -a "action=showdata filename=$file:BLAME" diff --git a/bin/acme-scripts/glo b/bin/acme-scripts/glo index b93a408..0d4195d 100755 --- a/bin/acme-scripts/glo +++ b/bin/acme-scripts/glo @@ -1,2 +1,2 @@ #!/bin/sh -exec gl --oneline +exec gl --oneline "$@" diff --git a/bin/acme-scripts/gls b/bin/acme-scripts/gls index 133a8b1..2c1f0c7 100755 --- a/bin/acme-scripts/gls +++ b/bin/acme-scripts/gls @@ -1,2 +1,2 @@ #!/bin/sh -exec gl --stat +exec gl --stat "$@" diff --git a/bin/acme-scripts/gv b/bin/acme-scripts/gv new file mode 100755 index 0000000..bf58941 --- /dev/null +++ b/bin/acme-scripts/gv @@ -0,0 +1,4 @@ +#!/bin/sh +# gv -- imitation of :GV! vim plugin +file=${1:-$samfile} +glo -- "$file" -- libgit2 1.1.1