Look, you already know that tmux lets you split your terminals or whatever. You know it lets you maintain remote sessions like a supercharged nohup. Neither of these features are very interesting, if you’re using a modern terminal emulator (or a tiling window manager) and doing your development locally.

So you’ve never tried tmux. People raved about it, but you didn’t listen: you’re not in the target audience. tmux is not for you.

I am projecting, obviously: that was my impression of tmux, a few years ago. Before I tried it. Before I learned how wrong I was.

Because it turns out tmux’s killer feature is actually–

Oh. You already saw. Darn. My dramatic reveal is ruined. Should have gone with a more clickbaity title.

Anyway, yes, tmux lets you select and copy text with your keyboard.

Mind-blowing? I mean, hopefully not. But also, kinda, right? How many hours of your life have you wasted reaching for the mouse and then moving your hand back to the keyboard just to copy that one commit hash? Trying to coax your terminal emulator to scroll at a reasonable speed so you could select a really long bit of command output?

Not very many? Yeah, fair enough. It’s not really that big of a deal. But it’s still nice to have the option.

but tmux is big and complicated and scary

I know what you’re thinking: nothing in this moment could bring me more joy than to be able to comfortably select and copy text on my terms. But tmux? It has so many features. I don’t want to learn a whole new thing just to avoid touching my mouse. I don’t want to use those weird dumb splits, or those weird dumb tabs. I don’t want to have to keep yet another definition of “window” straight. I like my iTerm, or my xmonad, and I feel like my life is hectic enough already. Plus I looked at a tmux keybinding cheatsheet once and now I’m upset and afraid.

Okay. It’s okay. I’m here for you. We’re going to get through this together.

You can use as much or as little of tmux as you want. You can set up tmux so that all it can do is select and copy text. You don’t have to have splits; you can keep using your native tabs. You can have the good stuff without any of the punctuation soup.

Here’s an example of a starter ~/.tmux.conf that lets you select text, and pretty much nothing else:

$ cat ~/.tmux.conf
set -g escape-time 1
set -g mouse on
set -g status off
set -g prefix S-C-M-w
set -g mode-keys vi

bind -n M-Space copy-mode

Run tmux, hit M-Space (or alt-space, or option-space), and get navigating.

q will exit “copy mode.” To start a selection, use Space instead of v: v toggles block and character mode, confusingly. And to copy, press Enter instead of y. So… not the best vi keys, out of the box. You can also set -g mode-keys emacs, if that’s your thing. Run tmux list-keys | grep -- '-T copy-mode-vi' or tmux list-keys | grep -- '-T copy-mode' (if you’re using emacs) to see all the keybindings.

You can, of course, rebind anything you want – make y work like vim, make Escape exit copy mode. tmux is very easy to customize; it’s easy to pick and choose exactly what you want. I wrote a whole blog post about setting up tmux à la carte. It will walk you through the basics of setting up a tmux config, demystify tmux’s if statement, and explain how to make tmux’s copy commands integrate with the system clipboard (which might just work out of the box, depending on your terminal emulator, but it might require another line or two in your config).

I even wrote a whole other blog post about quickly selecting the output of the last command, because tmux can’t do that out of the box, and it’s… very useful, but sort of difficult to get working.

But first: try that config up there for a while. Install tmux, and give it a shot. You won’t even notice that it’s running, unless you hit M-Space. Spend some time with it. If you don’t like it, there’s a 90-day return window, no questions asked.

you know you can just use Emacs’s shell-mode to–

yeah yeah yeah get outta here with that