Ladih
Ladih

Reputation: 811

How to set key binding to switch panes in tmux?

Here is my .tmux.conf

set-option -g prefix  C-\
bind-key C-p  select-pane -U
bind-key C-n  select-pane -D
bind-key C-b  select-pane -L
bind-key C-f  select-pane -R

What I want is to bind C-\ C-b to switch to the left pane, C-\ C-f to switch to the right pane and etc.
But I got the message .tmux.conf:2: usage: set-option [-agosquw] [-t target-session|target-window] option [value] when I started tmux.
Any idea how to do it?

Upvotes: 3

Views: 4661

Answers (1)

Andreas Grivas
Andreas Grivas

Reputation: 367

It has to do with your choice of prefix being C-\. The '\' character is used to indicate that the next line is a continuation of the set-option command. Add a gap after C-\ or quote C-\ as explained here: https://superuser.com/questions/417236/tmux-with-non-alphanumeric-prefix

You can use the following:

set-option -g prefix 'C-\'
bind-key C-p  select-pane -U
bind-key C-n  select-pane -D
bind-key C-b  select-pane -L
bind-key C-f  select-pane -R

Upvotes: 6

Related Questions