Change tmux command prefix.

The default tmux command prefix is Ctrl-b, which is fairly awkward. I NEVER use my right Ctrl key (maybe I should?), so Ctrl-b is quite a big movement for the fingers on my left hand. To truely live the keyboard/terminal/vim/tmux life you want to minimise the times your fingers have to move from the home row.

What is tmux?

Tmux is a command-line tool that allows users to split a terminal window into multiple panes or windows, each of which can run its own shell session or application. It provides advanced features such as multiple windows, pane splitting, session management, customizable key bindings, and a scriptable interface. Tmux is useful for developers or system administrators who need to work on multiple tasks simultaneously within a terminal environment. It is available on most Unix-like operating systems and can be installed using the system’s package manager.

The plan today

I’ve already mapped Capslock to Escape, and when I hold down Capslock with another key it acts like a Ctrl key. So the next logical step is to get away from the Ctrl-b, it’s just to far for a fairly well used command.

I’m going to try to remap to Ctrl-a, and test that out for a few weeks and see if that makes things easier.

Change your .tmux.conf file

Open up your ~/.tmux.conf file, and add the follow 2 lines:

unbind C-b
set-option -g prefix C-a

The first command unbind C-b removes the current Ctrl-b binding, the second command set-option -g prefix C-a set Ctrl-a as the main tmux command binding.

Reload tmux config

If you’re inside tmux and already have a few sessions open that you don’t want to close. You can reload the source by using the source command

source ~/.tmux.conf