Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

macos iterm2 tmux remap ctrl-b to right option/alt-a

Tags:

macos

iterm2

tmux

I thought this was a no brainer. I am using tmux with iterm2 (latest version) on maxOs on a MacBook.

Using ctrl-b as prefix is a terrible key combination for a MacBook, since the MacBook has only one control key, which is placed on the left hand side. So pressing these two buttons at the same time is almost painful for me. But tmux is awesome, so it lets you remap the prefix.

So, quite naively, I entered this line into my ~/.tmux.conf in order to set the prefix to option/alt-a:

set-option -g prefix M-a

However, that line didn't change a thing.

Entering tmux show-options -g still outputs

prefix C-b

Has anyone ever solved this?

BTW: I know I could use iterm2's tmux integration. But I don't want that. I want a plain text mode solution.

like image 970
LongHike Avatar asked Sep 01 '25 16:09

LongHike


1 Answers

Yeah, so I found a solution:

  1 # change ctrl-a to alt-a
  2 unbind C-b
  3 set-option -g prefix M-a
  4 bind C-a send-prefix

And then in iterm2 -> profiles -> [your profile] > Keys

for Right Option/Alt Key

click Esc+

I'm sorry. I found this solution, after having posted the question.

like image 124
LongHike Avatar answered Sep 05 '25 01:09

LongHike