Hi folks! If you’re reading this, chances are, you’re well acquainted with Tmux, and just like me, you love it for its remarkable capabilities. As we know, keyboard shortcuts are the heart and soul of Tmux. But what if we’re not too keen on the default prefix shortcut and want to change it? Well, you’ve come to the right place. In this blog post, I’ll walk you through the process of changing the prefix to a different keyboard shortcut in Tmux. Let’s dive in!
The default keyboard shortcut for prefix is Ctrl-B
in most Operating Systems. But, you can change it to any other keyboard shortcut of your choice. Let’s see how to do it.
Change Tmux prefix key to a new key binding
Let’s consider the case where you are using tmux and have the default keyboard prefix shortcut set to Ctrl-B
. Now, let’s say you want to change it to Ctrl-A
like the GNU screen keyboard shortcut, you can set the following config in ~/.tmux.conf
file-
set-option -g prefix C-a
unbind-key C-b
bind-key a send-prefix
Save the file ~/.tmux.conf
and then reload tmux conf–
Ctrl-B
:
source-file ~/.tmux.conf
Now, you will see that the prefix has changed to the new keyboard binding Ctrl-A
To test it, just try to zoom and unzoom the pane in the window-
Ctrl-A + z
I hope you found this article useful, glad that you found it easy to change prefix shortcut key in Tmux.
You can also check out the complete tmux cheatsheet of keyboard shortcuts and mouse shortcuts.
And that’s a wrap! We’ve navigated through the process of changing the prefix to a different keyboard shortcut in Tmux. With this newfound knowledge, you can now customize Tmux to better suit your preferences, making your terminal experience even more seamless. Remember, Tmux is as powerful as you make it. So, don’t hesitate to explore, experiment, and make it your own. Until next time, happy Tmux-ing!