Emacs As A Terminal Multiplexer

Torstein Krause Johansen runs Emacs in terminl mode on Linux. He likes to have several terminal sessions and switch between them. Previously, he used tmux to multiplex those terminal sessions onto a single screen but then tmux started crashing on him and he didn’t have the time or inclination to track down the problem.

Instead, he realized that he could do everything he wanted from within Emacs. That had the advantage of using the same key bindings that he was already using in Emacs and, less importantly, he didn’t have to worry about keeping the Emacs and tmux color schemes in sync. To accomplish that, he use vterm, multi-vterm, the built-in Emacs shell command, and a bit of custom Elisp, that he calls spawn-shell that allows him to create shells in named buffers the way he would in tmux.

Johansen has a video that explains how he does all this using just the packages and code above. It’s a really nice set up for those who like to run Emacs in terminal mode, of course, but even if you’re running Emacs in GUI mode, you can use the same strategy to provide multiple named shells all running from within Emacs. That’s pretty much what I do and it works well for me.

The video is short, only 5 and a quarter minutes so you can watch it pretty much any time you like. The slides are available but probably not too useful unless you want to copy the spawn-shell code. Definitely worth a few minutes of your time.

This entry was posted in General and tagged . Bookmark the permalink.