Acme
Acme is a text editor and programming environment from Plan9. I typically use the version provided by plan9port.
Unlike vim and emacs, the user interface of acme is structured around using a multi-button pointing device, like a mouse. To take full advantage of acme you need 3 mouse buttons:
- Button 1, select text.
- Button 1 double click, select word under cursor, or at the end/start of a line, select the whole line.
- Button 2, execute text.
- Button 3, plumb, if plumb fails, search for next occurrence of text.
On a mac with a touch pad:
- normal click is button 1
- option key + click is button 2
- two finger click is button 3
- command key + click is also button 3
The interface includes a handful of persistent button-like text that you can use to preform various tasks and actions.
Label | Description |
---|---|
Newcol | create a new column. |
Delcol | delete a column. |
New | create a new window. |
Put | write the body to disk. The file is the one named in the tag. |
Get | refresh the body. |
Zerox | creates another instance of the active window. |
Snarf | sort of like “copy” but a little different. |
Paste | normal paste. |
Exit | quit |
For me, the most wonderful thing about acme, though, is that it lets you run programs directly in the editor — need to grep through a directory? Write the snippet in the editor itself and use button 2 to execute the text!
Of note, I pretty much never summon acme by calling the program directly. Instead, I use a wrapping script like this one.
#!/bin/zsh -e
export SHELL="$PLAN9/bin/rc"
export acmeshell="$PLAN9/bin/rc"
export BROWSER=safari
export tabstop=4
export TERM=dumb
export PAGER=nobs
# Path to 'a' script itself
# I usually put this script in $PLAN9/bin
acme_bin_dir=$( cd $(dirname $0) && pwd )
# Where are the plumber rules?
# acme_plumber_rules="$acme_bin_dir/../plumbing"
# No custom plumbing rules right now
if [ "$(pgrep plumber)" ]; then
echo plumber is running
else
echo starting plumber
plumber
cat "$acme_plumber_rules" "$PLAN9/plumb/basic" | 9p write plumb/rules
fi
# for those times you wanna make node play nice with acme
export NODE_NO_READLINE=1
acme -a -f /mnt/font/GoMono/16a/font $1
This makes sure plumber is running, and starts it if it isn’t; grabs any custom plumber settings; makes sure acme is sourcing some default plumber stuff; and starts up with a larger than normal font so that I can read stuff. Also, a bit of sacrilege, I use a fixed width font in acme. Traditionally acme uses a proportional font.
I’ve found that acme’s win
command really only plays nice with the rc shell, so, I keep that configured for it.
Two things I keep in my .rcrc
config file,
fn la { ls -A $* }
fn ll { ls -l $* }
And a useful way to quickly open a file that you know is somewhere in the directory you are currently in, or lower, without having to go spelunking all the way down:
du -a | grep 'name-of-file'
du -a
will last all files and directories, grep finds your pattern. Who even needs a command palette when you’ve got unix goodness?
Other resources
rc shell stuff
Videos
Because the interaction model that acme expects is a little different from the text editors most folks are used to, I think videos offer some of the quickest insights into how to use it.
- Plan9 Acme Intro - Part 1
- Plan9 Acme Intro - Part 2
- Plan9 Acme Intro - Part 3
- Acme - Find and open a file based on the file name
- Acme - Search and Bracket Matching
- Using Acme with Git
Stuff to check out
This is a collection of stuff I intend to take for a spin, but that I haven’t had a chance to explore, yet.