On using Acme as a day-to-day text editor
I've been using the Acme text editor from Plan9Port as my standard text editor for about 9 months now. Before that, I have used Emacs and Vim quite a lot. I never really got the hang of either Sublime Text or TextMate. The latter because I couldn't run it on all operating systems, the former because is was too new to bother.With Acme, you sacrifice almost everything. There is no configuration file. This is a plus. I have spent way too much time messing with configuration, where I should have been messing with adaptation. The acme defaults are designed to be sensible and to be easy to work with. The standard font choice works well, and even though it is not antialiased by default, I tend to like the font nonetheless.
Other sacrifices are syntax highlighting, automatic indentation, specific language support and so on. But you gain that the editor always work and there are no upgrades which bother you when working. The editor is built to be a window manager of sorts and you use it as a hub to connect other software together. This hub becomes the main focus of everything you are doing.
What pleases me about the acme editor is that it is simple. You can learn most things it can do in a week and then the power stems from combination of those simple things. It is very much a Zen-style editor with few things going on. You will have to like that choices have been made for you and that you have to adapt to those. But with this editor I spend much more time working on code bases than trying to get my editor to behave.
Setting up acme
- Grab Plan 9 from User Space and
./INSTALL
it somewhere. This gives you the basis environment, but it does require some help to get running. - Grab Plan 9 setup which is my small tools as shell scripts to manipulate files
- I have some changes to
$HOME/.profile
:
export BROWSER='chromium' PLAN9=/home/jlouis/P/plan9 PATH=$PATH:$PLAN9/bin # Plumb files instead of starting new editor. EDITOR=E unset FCEDIT VISUAL # Get rid of backspace characters in Unix man output. PAGER=nobs # Default font for Plan 9 programs. font=$PLAN9/font/lucsans/euro.8.font # Equivalent variables for rc(1). home=$HOME prompt="$H=; " user=$USER export \ BROWSER\ ⋯ PLAN9\ ⋯ font\ home\ prompt\ user
- Acme is started once through the
acme-start.rc
script. This also starts the plumber service. $HOME/lib/plumbing
is linked so I get some additional plumbing rules in addition to the default rules primarily quick access to github stuff
On mouse usage
Acme requires a good mouse to be really effective. Find a gaming mouse with good DPI resolution and then proceed to configure it so it has acceleration and sensitivity settings that you like. It shouldn't be needed to move the mouse too much, yet the movement should be precise. Some mice has microprocessors in them which smooths movement so when you sweep a line, it is easier to stay on the line. It all depends on what mouse you have.In a moded editor like vim, you are usually either in command mode for cursor movement or in insert mode for entering text. To understand acme, it is the same, either you have a hand on your mouse and are doing commands, or you are inserting text into the buffer at some place. Note that in a system like acme, you can do a lot of tasks on the mouse alone. You can double-click next to a " character to select the whole string or to select pairs (), [] or {}. Click in the start of a line select the whole line. And so on. Since you can also select the \n character, you can easily move around large textual parts of the code. Cut, copy and paste is also on the mouse alone. So most of the (common) things you do in the vim command mode is done with the mouse.
You do have access to a command language, which comes from the sam(1) editor. Learning how that language works helps a lot. I do a lot of my surgery on files by writing commands that change the contents of a selection.
Is the mouse more efficient than the keyboard? Hell yes! The more complex an editing task is, the more effective the mouse is. And for most other simple things, the speed is about the same as the keyboard movement for me.
Working with acme
The key concept of acme is that you use it as the main entry point for all work you do. One of my screens is full-screen acme, and it usually runs two major windows in acme, at the least:scratch
and win
. The latter is a standard shell so you can open files and operate on commands. I either open files by doing lc
and then 3-click them or by executing B <filename>
. Remember that ^F
completes filenames.The
scratch
is a file I continually write containing helper commands, small snippets, GH references and so on. I usually have a global one, and one per project I am working on. Usual contents:- Urls to important web pages. 3-click them and chromium takes you there
- Github issues
- Git branch names enclosed in brackets:
[jl/fix-eqc-test/37]
- Notes of importance, thougths.
- Complex commands with notes on their usage so they can be copied in and used quickly
gg foo
command you can just Snarf
it and then use the Send
command in the shell window to fire it off in the source code.I usually keep done things in the scratch buffer as well for documentation. Every 2-3 months I then move it to a file
scratch.$(date +%Y%m%d)
to remember that.I make heavy use of the fact that acme has a neat way to enter unicode directly, so there are a lot of correct punctuation and a lot of things you won't usually see in ASCII. The editor uses a variable width font by default which is really good when reading and scratching stuff down. Though I also use the
Font
command if I need a fixed-with font at times.Acme is a visual-spatial editor environment. By default, it doesn't hide information from you. At work, it is not uncommon that i have over 50 open buffers on a big 27 inch Mac display. You can do that with acme easily and since you have spatiality, you can also remember where you put a window and get back to it easily. I usually run 4 columns:
- One with documentation and scratch pads.
- One which contain the main code I am working on right now.
- One with shells, erlang shells and code mixed.
- A narrow strip containing directory output to quickly get at a specific file. This strip also holds windows with error output.
Working with Erlang in acme
Most of what I do is Erlang. I sometimes work in different languages, but the operation is roughly the same.- A shell is used to run
rebar compile
. I add[rebar compile]
to the tag and then click at the right of[
to select it. A 2-click now recompiles. Other typical things in the tag could bemake
ormake test
and so on. - The
gg
command is a shorthand forgit grep -n
. Need a specific thing? I gg it and then the filename comes up with a line number. 3-clicking it is understood by the plumber to open that file on that line. - I tend to avoid using tools which can follow code paths. Mainly because if you need a tool, then chances are that the code itself is quite convoluted and nasty
- I have a window which runs an erlang console for the project I am working on. I often dynamically load code into the erlang node and test it out. It is rare that I reboot the node unless I am doing something startup-specific coding.
- Documentation:
Edit , <erl -man lists
in a dummy window for the purpose - I often search for code.
:/^keyfind
will search for keyfind, but at the start of the line. I keep such a line around in the tag for searches. - The
Edit , d
command clears a window by selecting all contents and then deleting it. - I often utilize the shell commands:
<date +%Y-%m-%d
inserts the current date into the buffer for instance. Selecting text and sending it through|sort
will sort export lists and atom tables. - Each project is written to a dump file with
Dump acme.projectname
. This way, you can easily get back withLoad acme.projectname
which restores your current window layout and more. - I use the shell a lot when I write code. In practice I see the UNIX system as the IDE and then I use acme to access that IDE. It works wonders.
Add a comment