Search code examples
macostmuxiterm2

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


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.


Solution

  • 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.