From 051ecf8fcea5e2eb95457c78a2f2d5709f26f14c Mon Sep 17 00:00:00 2001 From: Alex Karle Date: Sat, 30 Dec 2023 00:11:03 -0500 Subject: [PATCH] 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 :) --- README | 13 ------------- bin/a | 12 ------------ bin/acme-scripts/Bhist | 7 ------- bin/acme-scripts/Bls | 4 ---- bin/acme-scripts/Gbrowse | 8 -------- bin/acme-scripts/Note | 12 ------------ bin/acme-scripts/e | 3 --- bin/acme-scripts/f8 | 2 -- bin/acme-scripts/ga | 2 -- bin/acme-scripts/gbl | 4 ---- bin/acme-scripts/gc | 2 -- bin/acme-scripts/gca | 2 -- bin/acme-scripts/gd | 2 -- bin/acme-scripts/gg | 4 ---- bin/acme-scripts/gl | 5 ----- bin/acme-scripts/glo | 2 -- bin/acme-scripts/gls | 2 -- bin/acme-scripts/gs | 2 -- bin/acme-scripts/gv | 4 ---- bin/acme-scripts/i+ | 2 -- bin/acme-scripts/i- | 2 -- bin/acme-scripts/jq | 3 --- bin/acme-scripts/nas | 14 -------------- bin/acme-scripts/t2s | 3 --- bin/tmux-plumb | 51 --------------------------------------------------- bin/wiseman | 19 ------------------- lib/plumbing | 45 --------------------------------------------- 27 files changed, 231 deletions(-) delete mode 100755 bin/a delete mode 100755 bin/acme-scripts/Bhist delete mode 100755 bin/acme-scripts/Bls delete mode 100755 bin/acme-scripts/Gbrowse delete mode 100755 bin/acme-scripts/Note delete mode 100755 bin/acme-scripts/e delete mode 100755 bin/acme-scripts/f8 delete mode 100755 bin/acme-scripts/ga delete mode 100755 bin/acme-scripts/gbl delete mode 100755 bin/acme-scripts/gc delete mode 100755 bin/acme-scripts/gca delete mode 100755 bin/acme-scripts/gd delete mode 100755 bin/acme-scripts/gg delete mode 100755 bin/acme-scripts/gl delete mode 100755 bin/acme-scripts/glo delete mode 100755 bin/acme-scripts/gls delete mode 100755 bin/acme-scripts/gs delete mode 100755 bin/acme-scripts/gv delete mode 100755 bin/acme-scripts/i+ delete mode 100755 bin/acme-scripts/i- delete mode 100755 bin/acme-scripts/jq delete mode 100755 bin/acme-scripts/nas delete mode 100755 bin/acme-scripts/t2s delete mode 100755 bin/tmux-plumb delete mode 100755 bin/wiseman delete mode 100644 lib/plumbing diff --git a/README b/README index b1bc2fe..0c9a9e3 100644 --- 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 deleted file mode 100755 index c62f4bf..0000000 --- a/bin/a +++ /dev/null @@ -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 deleted file mode 100755 index ed2315c..0000000 --- a/bin/acme-scripts/Bhist +++ /dev/null @@ -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 deleted file mode 100755 index 2453878..0000000 --- a/bin/acme-scripts/Bls +++ /dev/null @@ -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 deleted file mode 100755 index dc6c4f3..0000000 --- a/bin/acme-scripts/Gbrowse +++ /dev/null @@ -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 deleted file mode 100755 index 90a3996..0000000 --- a/bin/acme-scripts/Note +++ /dev/null @@ -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 deleted file mode 100755 index a7ca409..0000000 --- a/bin/acme-scripts/e +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -# e -- shortcut for editinacme -exec editinacme "$@" diff --git a/bin/acme-scripts/f8 b/bin/acme-scripts/f8 deleted file mode 100755 index a3cdf1d..0000000 --- a/bin/acme-scripts/f8 +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -flake8 ${samfile:--} diff --git a/bin/acme-scripts/ga b/bin/acme-scripts/ga deleted file mode 100755 index 0900b9a..0000000 --- a/bin/acme-scripts/ga +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -exec git add "$@" diff --git a/bin/acme-scripts/gbl b/bin/acme-scripts/gbl deleted file mode 100755 index 9a54274..0000000 --- a/bin/acme-scripts/gbl +++ /dev/null @@ -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 deleted file mode 100755 index 6243728..0000000 --- a/bin/acme-scripts/gc +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -exec git commit "$@" diff --git a/bin/acme-scripts/gca b/bin/acme-scripts/gca deleted file mode 100755 index ecf7559..0000000 --- a/bin/acme-scripts/gca +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -exec git commit -a "$@" diff --git a/bin/acme-scripts/gd b/bin/acme-scripts/gd deleted file mode 100755 index bea935d..0000000 --- a/bin/acme-scripts/gd +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -exec git diff "$@" diff --git a/bin/acme-scripts/gg b/bin/acme-scripts/gg deleted file mode 100755 index 467a521..0000000 --- a/bin/acme-scripts/gg +++ /dev/null @@ -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 deleted file mode 100755 index 2397ef7..0000000 --- a/bin/acme-scripts/gl +++ /dev/null @@ -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 deleted file mode 100755 index 0d4195d..0000000 --- a/bin/acme-scripts/glo +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -exec gl --oneline "$@" diff --git a/bin/acme-scripts/gls b/bin/acme-scripts/gls deleted file mode 100755 index 37b7d3f..0000000 --- a/bin/acme-scripts/gls +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -exec gl --stat --decorate "$@" diff --git a/bin/acme-scripts/gs b/bin/acme-scripts/gs deleted file mode 100755 index d1de923..0000000 --- a/bin/acme-scripts/gs +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -exec git status "$@" diff --git a/bin/acme-scripts/gv b/bin/acme-scripts/gv deleted file mode 100755 index bf58941..0000000 --- a/bin/acme-scripts/gv +++ /dev/null @@ -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+ deleted file mode 100755 index 8fc7768..0000000 --- a/bin/acme-scripts/i+ +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -sed 's/^/ /' "$@" diff --git a/bin/acme-scripts/i- b/bin/acme-scripts/i- deleted file mode 100755 index db0bf3c..0000000 --- a/bin/acme-scripts/i- +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -sed 's/^ //' diff --git a/bin/acme-scripts/jq b/bin/acme-scripts/jq deleted file mode 100755 index 2c26770..0000000 --- a/bin/acme-scripts/jq +++ /dev/null @@ -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 deleted file mode 100755 index 41f2591..0000000 --- a/bin/acme-scripts/nas +++ /dev/null @@ -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 deleted file mode 100755 index 1ae2dba..0000000 --- a/bin/acme-scripts/t2s +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -# t2s -- tabs to spaces -sed 's/ / /g' "$@" diff --git a/bin/tmux-plumb b/bin/tmux-plumb deleted file mode 100755 index a17c764..0000000 --- a/bin/tmux-plumb +++ /dev/null @@ -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 deleted file mode 100755 index bd6c228..0000000 --- a/bin/wiseman +++ /dev/null @@ -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 deleted file mode 100644 index 903ff9c..0000000 --- a/lib/plumbing +++ /dev/null @@ -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 -- libgit2 1.1.1