commit 051ecf8fcea5e2eb95457c78a2f2d5709f26f14c (patch)
parent 704c11661fb8bbe6e3e887648c9d62b8f165f350
Author: Alex Karle <alex@alexkarle.com>
Date: Sat, 30 Dec 2023 00:11:03 -0500
cleanup: Remove acme / plan9 scripts
I gave acme a real whirl a year or two ago. It's fun
to look back on these and remember how I was trying
to bend it into my workflows... but its just too
impractical for my day-to-day usage (or even hobby
usage). I'll stick to ed(1) when I want to be quirky :)
Diffstat:
27 files changed, 0 insertions(+), 232 deletions(-)
diff --git a/README b/README
@@ -12,16 +12,3 @@ These are MIT-licensed dragons, so hack away!
I'm in a transitionary period where I started fresh in 2022
with a clean-room reimplementation of my old dotfiles (to
relicense them as FOSS), so some areas are a bit in-flux.
-
-That said, starting fresh has been a good excuse to make some
-radical changes!
-
-Some mildly-interesting reasons to look inside:
-
-* I'm slowly integrating a plan9-style plumber with tmux(1)
-
-* Configs are tested on OpenBSD and Linux. Most scripts are
- POSIX sh(1) though and should be portable.
-
-* There's an emphasis on small, reusable, and keyboard-driven
- tools.
diff --git a/bin/a b/bin/a
@@ -1,12 +0,0 @@
-#!/bin/sh
-PLAN9=${PLAN9:-/usr/lib/plan9}
-export PAGER=nobs
-export EDITOR=editinacme # from 9fans.net/go
-unset VISUAL
-export TERM=dumb
-export NO_COLOR=1
-export SHELL=$PLAN9/bin/rc
-export PATH="$(dirname "$(readlink -f "$0")")/acme-scripts:$PATH"
-acme -b -a \
- -f /mnt/font/AtkinsonHyperlegible-Regular/12a/font \
- -F /mnt/font/GoMono/10a/font "$@"
diff --git a/bin/acme-scripts/Bhist b/bin/acme-scripts/Bhist
@@ -1,7 +0,0 @@
-#!/bin/sh
-# Bhist -- capture buffer history
-set -e
-mkdir -p "$HOME/.cache/acme"
-echo "Bhist start: $(date)" >> "$HOME/.cache/acme/buffer_history.txt"
-9p read acme/log | grep '^[0-9]* new' \
- | sed -l 's/^[0-9]* new//' >> "$HOME/.cache/acme/buffer_history.txt"
diff --git a/bin/acme-scripts/Bls b/bin/acme-scripts/Bls
@@ -1,4 +0,0 @@
-#!/bin/sh
-# Bls -- list buffer history
-tail -r "$HOME/.cache/acme/buffer_history.txt" | uniq \
- | plumb -i -d edit -a 'action=showdata filename=+BufferHistory'
diff --git a/bin/acme-scripts/Gbrowse b/bin/acme-scripts/Gbrowse
@@ -1,8 +0,0 @@
-#!/bin/sh
-set -e
-REPO=$(git rev-parse --show-toplevel)
-[ -z "$REPO" ] && exit 1
-FILE=${1:-$(readlink -f $samfile)}
-resource=${FILE##$REPO/}
-url=$(git remote get-url origin | sed -e 's/^git@//' -e 's@:@/@' -e 's/\.git$//')
-${BROWSER:-firefox} "https://$url/blob/master/$resource"
diff --git a/bin/acme-scripts/Note b/bin/acme-scripts/Note
@@ -1,12 +0,0 @@
-#!/bin/sh
-name=${1:-scratch/$(/usr/bin/date +%F).txt}
-
-file=$HOME/notes/$name
-
-if [ -e $file ]; then
- # Just open the existing file!
- plumb -d edit $file
-else
- # Open in a buffer but don't save to the file yet -- will likely rename!
- (date; echo) | plumb -i -d edit -a "action=showdata filename=$HOME/notes/$name"
-fi
diff --git a/bin/acme-scripts/e b/bin/acme-scripts/e
@@ -1,3 +0,0 @@
-#!/bin/sh
-# e -- shortcut for editinacme
-exec editinacme "$@"
diff --git a/bin/acme-scripts/f8 b/bin/acme-scripts/f8
@@ -1,2 +0,0 @@
-#!/bin/sh
-flake8 ${samfile:--}
diff --git a/bin/acme-scripts/ga b/bin/acme-scripts/ga
@@ -1,2 +0,0 @@
-#!/bin/sh
-exec git add "$@"
diff --git a/bin/acme-scripts/gbl b/bin/acme-scripts/gbl
@@ -1,4 +0,0 @@
-#!/bin/sh
-# git blame, in acme!
-file=${1:-$samfile}
-git blame --date="short" "$file" | plumb -i -d edit -a "action=showdata filename=$file:BLAME"
diff --git a/bin/acme-scripts/gc b/bin/acme-scripts/gc
@@ -1,2 +0,0 @@
-#!/bin/sh
-exec git commit "$@"
diff --git a/bin/acme-scripts/gca b/bin/acme-scripts/gca
@@ -1,2 +0,0 @@
-#!/bin/sh
-exec git commit -a "$@"
diff --git a/bin/acme-scripts/gd b/bin/acme-scripts/gd
@@ -1,2 +0,0 @@
-#!/bin/sh
-exec git diff "$@"
diff --git a/bin/acme-scripts/gg b/bin/acme-scripts/gg
@@ -1,4 +0,0 @@
-#!/bin/sh
-# gg -- git grep with numbers. Not a git alias for use with acme(1)
-# (which works best with commands with no spaces)
-exec git grep -n "$@"
diff --git a/bin/acme-scripts/gl b/bin/acme-scripts/gl
@@ -1,5 +0,0 @@
-#!/bin/sh
-# git-log, but piped through plumb so that it:
-# 1. doesn't scroll to the end
-# 2. has the proper "filename" so that plumbing SHA's works
-git log "$@" | plumb -i -d edit -a "action=showdata filename=/$(pwd)/git-log"
diff --git a/bin/acme-scripts/glo b/bin/acme-scripts/glo
@@ -1,2 +0,0 @@
-#!/bin/sh
-exec gl --oneline "$@"
diff --git a/bin/acme-scripts/gls b/bin/acme-scripts/gls
@@ -1,2 +0,0 @@
-#!/bin/sh
-exec gl --stat --decorate "$@"
diff --git a/bin/acme-scripts/gs b/bin/acme-scripts/gs
@@ -1,2 +0,0 @@
-#!/bin/sh
-exec git status "$@"
diff --git a/bin/acme-scripts/gv b/bin/acme-scripts/gv
@@ -1,4 +0,0 @@
-#!/bin/sh
-# gv -- imitation of :GV! vim plugin
-file=${1:-$samfile}
-glo -- "$file"
diff --git a/bin/acme-scripts/i+ b/bin/acme-scripts/i+
@@ -1,2 +0,0 @@
-#!/bin/sh
-sed 's/^/ /' "$@"
diff --git a/bin/acme-scripts/i- b/bin/acme-scripts/i-
@@ -1,2 +0,0 @@
-#!/bin/sh
-sed 's/^ //'
diff --git a/bin/acme-scripts/jq b/bin/acme-scripts/jq
@@ -1,3 +0,0 @@
-#!/bin/sh
-# monochrome jq
-exec /usr/bin/jq -M "$@"
diff --git a/bin/acme-scripts/nas b/bin/acme-scripts/nas
@@ -1,14 +0,0 @@
-#!/bin/sh
-# nas -- new acme script
-DIR=$(dirname "$(readlink -f "$0")")
-
-if [ -z "$1" ]; then
- echo "usage: nas FILE" 1>&2
- exit 1
-fi
-
-file="$DIR/$1"
-
-touch "$file"
-chmod +x "$file"
-B "$file"
-\ No newline at end of file
diff --git a/bin/acme-scripts/t2s b/bin/acme-scripts/t2s
@@ -1,3 +0,0 @@
-#!/bin/sh
-# t2s -- tabs to spaces
-sed 's/ / /g' "$@"
diff --git a/bin/tmux-plumb b/bin/tmux-plumb
@@ -1,51 +0,0 @@
-#!/bin/sh
-# plumb -- plumber for tmux's copy-pipe
-# reads the item to plumb from stdin, optionally takes a working dir
-# most items open in a new tmux split, or new window if -w given
-args=$(getopt w $*)
-if [ "$?" != "0" ]; then
- echo "usage: plumb [-w] [directory]" 1>&2
- exit 1
-fi
-
-set -- $args
-while [ "$#" != "0" ]; do
- case "$1" in
- -w) NEW_WINDOW=1 ; shift ;;
- --) shift ; break ;;
- esac
-done
-
-if [ -n "$1" ]; then
- cd "$1"
- shift
-fi
-
-tmuxdo() {
- if [ "$NEW_WINDOW" = "1" ]; then
- tmux new-window sh -c "$1"
- else
- tmux split-window sh -c "$1"
- fi
-}
-
-# only accept first argument (by whitespace)
-read ITEM
-ITEM=$(echo "$ITEM" | awk '{ sub("^~", ENVIRON["HOME"], $1); print $1 }')
-
-case "$ITEM" in
- http*) xdg-open "$ITEM" ;;
- [a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9]*) \
- tmuxdo "git show $ITEM 2>&1 | less" ;;
- [a-zA-Z0-9._-]*:[0-9]*:*) tmuxdo "fned \"$ITEM\"" ;;
- [a-zA-Z0-9._-]*\([1-9]\))
- PAGE=${ITEM%%\([1-9]\)}
- tmuxdo "man \"$PAGE\"" ;;
- *)
- if [ -d "$ITEM" ]; then
- tmuxdo "cd $ITEM && $SHELL"
- elif [ -e "$ITEM" ]; then
- tmuxdo "${EDITOR:-vi} $ITEM"
- fi
- ;;
-esac
diff --git a/bin/wiseman b/bin/wiseman
@@ -1,19 +0,0 @@
-#!/bin/sh
-# wiseman -- for the plumber, use the correct man for plan9 vs unix
-set -e
-die() {
- echo "$*" 1>&2
- exit 1
-}
-
-[ -z "$1" ] && die "usage: wiseman SECTION NAME"
-[ -z "$2" ] && die "usage: wiseman SECTION NAME"
-
-section="$1"
-page="$2"
-
-if [ -e "$PLAN9/man/man$section/$page.$section" ]; then
- 9 man "$section" "$page"
-else
- /usr/bin/man "$section" "$page"
-fi
diff --git a/lib/plumbing b/lib/plumbing
@@ -1,45 +0,0 @@
-# plan9 plumbing rules
-#
-# currently in use in acme(1) on Linux via plan9port.
-#
-# see /usr/lib/plan9/plumb, plumb(7), and regexp(7)
-# to update: cat $home/lib/plumbing | 9p write plumb/rules
-
-# urls go to web browser
-type is text
-data matches '(https?|file)://[a-zA-Z0-9_@\-]+([.:][a-zA-Z0-9_@\-]+)*/?[a-zA-Z0-9_?,%#~&/\-+=]+([:.][a-zA-Z0-9_?,%#~&/\-+=]+)*'
-plumb to web
-plumb start chromium $0
-
-# image files go to feh
-type is text
-data matches '[a-zA-Z0-9_\-./]+'
-data matches '([a-zA-Z0-9_\-./]+)\.(jpe?g|JPE?G|gif|GIF|png|PNG)'
-arg isfile $0
-plumb to image
-plumb start feh $file
-
-# pdf files go to chromium
-type is text
-data matches '[a-zA-Z0-9_\-./]+'
-data matches '([a-zA-Z0-9_\-./]+)\.(pdf|PDF)'
-arg isfile $0
-plumb start chromium $file
-
-# man pages use wiseman to support both system and plan9 roff formats
-type is text
-data matches '([a-zA-Z¡-0-9_\-./]+)\(([1-8])\)'
-plumb start rc -c 'wiseman '$2' '$1' >[2=1] | nobs | plumb -i -d edit -a ''action=showdata filename=/man/'$1'('$2')'''
-
-# sha1's to git
-type is text
-data matches '[a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9]+'
-plumb start rc -c 'git -C '$wdir' show '$0' >[2=1] | plumb -i -d edit -a ''action=showdata filename=/'$wdir'/'$0''''
-
-# #PR numbers to openpr (for work)
-type is text
-data matches '#([0-9]+)'
-plumb start rc -c 'cd '$wdir' && openpr '$1'
-
-editor = acme
-include basic