From 9177c8488c62a0c315ce0c2cda465c1da8de50df Mon Sep 17 00:00:00 2001 From: jbranchaud Date: Fri, 18 Dec 2020 22:18:40 -0600 Subject: [PATCH] Add Change The Default Prefix Key as a tmux til --- README.md | 3 ++- tmux/change-the-default-prefix-key.md | 25 +++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 tmux/change-the-default-prefix-key.md diff --git a/README.md b/README.md index cd4aee6..2bced9e 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ and pairing with smart people at Hashrocket. For a steady stream of TILs, [sign up for my newsletter](https://tinyletter.com/jbranchaud). -_976 TILs and counting..._ +_977 TILs and counting..._ --- @@ -861,6 +861,7 @@ _976 TILs and counting..._ - [Adjusting Window Pane Size](tmux/adjusting-window-pane-size.md) - [Break Current Pane Out To Separate Window](tmux/break-current-pane-out-to-separate-window.md) - [Change Base Directory Of Existing Session](tmux/change-base-directory-of-existing-session.md) +- [Change The Default Prefix Key](tmux/change-the-default-prefix-key.md) - [Create A Named tmux Session](tmux/create-a-named-tmux-session.md) - [Create A New Session In A New Server](tmux/create-a-new-session-in-a-new-server.md) - [Cycle Through Layouts](tmux/cycle-through-layouts.md) diff --git a/tmux/change-the-default-prefix-key.md b/tmux/change-the-default-prefix-key.md new file mode 100644 index 0000000..03c7406 --- /dev/null +++ b/tmux/change-the-default-prefix-key.md @@ -0,0 +1,25 @@ +# Change The Default Prefix Key + +The _prefix_ key for tmux is a key that tells an active tmux session that the +following key should be interpreted as a tmux command instead of regular input +to the terminal. + +By default, tmux has `Ctrl-b` bound to the prefix. + +So, hitting `Ctrl-b` followed by `?` will open up the tmux help. + +Typing `Ctrl-b` involves a bit of a finger stretch. It can be changed to +something more comfortable. My personal preference is `Ctrl-z`. Many +configurations I've seen use `Ctrl-a`. + +To change this, open up your `~/.tmux.conf` file and add two lines. + +``` +unbind C-b +set -g prefix C-z +``` + +And then run `:source-file ~/.tmux.conf`. + +This tells tmux to unbind `Ctrl-b` so that it no longer is interpreted as the +prefix, and then it binds `Ctrl-z` as the new prefix key.