A short description of my Acme setup

This is a short description of my Acme setup, mostly so that I don’t forget the details.

And Acme from plan9port.

LSP

I use gopls as the language server for Go development, clangd for C/C++, and rls for Rust.

Hardware

I mostly use Acme with an Evoluent VerticalMouse 4, because that makes things like the 2-1 chord easier to perform and a vertical mouse is easier on the wrist than a regular flat mouse.

If I’m not at my desk, using Acme with just the touchpad and Ctrl/Alt (on Linux) or Command/Option (on MacOS) works nicely as well.

Scripts

This is the script I use to start Acme:

 1#!/usr/bin/env -S 9 rc -x
 2
 3# Starts all the stuff required for Acme to work nicely
 4
 59 plumber
 6
 7if (~ `{pgrep fontsrv} '') {
 8	9 fontsrv &
 9}
10
11if (~ `{pgrep autokey} '') {
12	autokey &
13}
14
15if (~ $fontsz '') {
16	fontsz=19
17}
18
19monospace=DejaVuSansMono
20proportional=DejaVuSans
21
22# monospace=GoMono
23# proportional=GoRegular
24
25# monospace=NotoMono
26# proportional=NotoSans-Regular
27
28# monospace=GoMono
29# proportional=InputSerif-Regular
30
31# monospace=UbuntuMono-Regular
32# proportional=Ubuntu
33
34# acmebin=$home^/go/bin/acme
35acmebin=$home^/plan9port/bin/acme
36
37touch $home^/acme.dump
38
39$acmebin -a \
40	-l $home^/acme.dump \
41	-F '/mnt/font/'^$monospace^'/'^$fontsz^'a/font' \
42	-f '/mnt/font/'^$proportional^'/'^$fontsz^'a/font' &
43
44sleep 1
45acmefocused &
46acme-lsp &
47Adefaults &
48

Adefaults is the following script. It adds default options to the tag line of various Acme windows, depending on the file name:

 1#!/bin/bash
 2
 39p read acme/log | while read line; do
 4	winid=$(echo "$line" | cut -d' ' -f1)
 5	action=$(echo "$line" | cut -d' ' -f2)
 6	fname=$(echo "$line" | cut -d' ' -f3-)
 7
 8	if [[ "$action" != "new" ]]; then
 9		continue
10	fi
11
12	if [[ -d "$fname" ]]; then
13		(
14			if [[ -e "$fname"/go.mod ]]; then
15				printf "Lws+ "
16			fi
17		) | 9p write acme/$winid/tag
18	else
19		# Regular file
20		(
21			case "$fname" in
22				*.beancount)
23					printf '[fava $%%] :$ '
24					;;
25				*.md|*/guide)
26					printf "|fmt |Check"
27					;;
28				*.go|*.cpp|*.h|*.rs|*.ml|*.mli)
29					printf "Lfmt Ldef Lrefs Lhov "
30					;;
31				*.py)
32					printf "[Edit ,x/	/c/    /] "
33					;;
34				*/COMMIT_EDITMSG|*.jjdescription)
35					printf "|fmt "
36					;;
37				/tmp/neomutt-*)
38					printf "|par "
39					;;
40			esac
41		) | 9p write acme/$winid/tag
42	fi
43done