Change tmux command prefix

1 minute read

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.

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