Modality kills (or how I learned to love emacs and stop swearing at tmux)
I’m an Emacs switcher.
There. I’m out of the closet.
After 18 long years of vi, I finally switched to emacs. Despite many attempted explanations in <= 140 characters and numerous requests, I’ve relented and written this to explain why.
I’ve been a remote worker for over 4 years now. But, as an extrovert (yes, I’m freakish that way as a developer), I love to pair program. I’ve blogged about my pair-programming tool chain in the past. That tool chain has continued to evolve. The crucial point: I need to live in my shell to remote pair as I do.
And most recently, I learned that modality kills.
VI is modal. Tmux, my preferred terminal multiplexer, is also modal.
modal * modal = modality2
Put another way, usability goes straight to hell.
So here I am, minding my own business, writing some code in VI. When, all of a sudden, I decide that I want to switch to my terminal running in the other window in my vertically split tmux session. So I switch windows and try to scroll up with
Ctrl-u. What the hell? Why doesn’t this work?
Ctrl-u Ctrl-u Ctrl-u dammit!
Oh. Right. I’m in tmux.
Ctrl-b [ Ctrl-u works. Finally.
Now repeat this a few hundred times.
(Much cursing at VI and tmux have been elided here to reduce your enjoyment of this article.)
The basal ganglia, physical memory, doesn’t understand this modal shit. You’re doing something. Then you’re doing something similar. It should work pretty much the same way, dammit. If I’m banging around in a terminal or hunting a sabertooth tiger the mental model should remain consistent. But, oh, that’s right: digital reality has little basis in the real world. Unfortunately, our brains just don’t quite get that.
And, dammit, modality makes all of that worse.
Sure, I learned to cope with VIs modality. Sort of. Let’s be honest, VI users. You know that you frequently are in command mode when you thought you were in insert mode and vice versa. But you develop coping strategies. Then you almost forget that you’re using them.
Now imagine having to have habits to cope with making that same mistake but in a shell within tmux instead of the VI session that you thought you were in.
Down this path lies madness.
And, so, I found my way to emacs. Emacs gives you eshell for standard: a LISP-based terminal emulator. ansi-term is a small step up from eshell. But I still found myself having problems with it. Then my friend Avdi Grimm pointed me at multi-term. I have been happy ever since.
You see, multi-term is a “major mode” of emacs. While it does commandeer a great many of the ordinary key bindings, at least I can scroll up or search through a multi-term history the same way that I would any ordinary emacs buffer. Though, for the life of me, I cannot understand why scroll down automatically throws me back to the prompt instead of actually scrolling down.
Oh, did I mention that emacs has an actual programming language, emacs lisp, instead of the vim’s sadomasochistic vision of hell known as vimscript?
Yes, I still use tmux. But now I solely use tmux per its name: as a terminal multiplexer. I don’t need to create windows: emacs gives me that. I don’t search within tmux sessions: emacs gives me that. Tmux barely matters any more except for facilitating sharing my session with another user. And that’s about it.
In case you’re deeply concerned about the productivity hit, I was running at about 75% or so after just a few days.
If you remote pair and live in the shell, you owe it to yourself: switch to emacs.
Posted by evan on Monday, February 11, 2013blog comments powered by Disqus