A bit about tmux
Tmux does pretty much everything that screen does, but tmux has an easy to understand configuration format, some nice defaults, and a clear and understandable man page. In particular though, one thing that I like about tmux is that I can issue commands to tmux from the shell. For instance, if I wanted to bind the F5 key to executing my favourite app in the background, this is the line I would put in my configuration file:
bind-key -n F5 run-shell /my/favourite/app
If I wanted to perform the same key binding from a shell within a tmux session, I would type:
$ tmux bind-key -n F5 run-shell /my/favourite/app
What I want it for
At the moment, I don’t actually want tmux for its terminal multiplexing abilities, nor for its ability to detach and reattach sessions. What I’m looking for at the moment is the ability to scroll through my terminal history, select text and copy it to the system clipboard. This is something I can do in most terminal emulators, but I want to be able to do it efficiently without moving my hands away from my keyboard. The ability to use Vim-like key bindings would also be a bonus since I’m familiar with them.
What it does and doesn’t do
Using tmux, I can enter copy mode with the keyboard, scroll around, and copy things to the tmux clipboard. If I want to use Vim-like key bindings, I can issue the tmux command
mode-keys vi. I can use the
bind-key command if I don’t quite like the default vi key bindings. If I install xsel, I can copy things from the tmux clipboard to the system clipboards using
tmux show-buffer | xsel -pb. I can even set up a key binding so that I can enter copy mode with a single keystroke rather than having to press Ctrl+b [. But you only have limited ability to remap keys within edit mode. For instance, in edit mode you can’t execute a shell command. So I can’t set things up so that the same keystroke which copies selected text to a tmux clipboard also copies to the system clipboard. And this is a huge nuisance to me because the whole reason I was looking at tmux was to improve my efficiency when using a terminal.
Perhaps I’ll have to write my own.