如何设置键绑定以在 tmux 中切换窗格?

How to set key binding to switch panes in tmux?

这是我的 .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

我想要的是绑定C-\ C-b切换到左窗格,C-\ C-f切换到右窗格等等
但是我在启动 tmux 时收到消息 .tmux.conf:2: usage: set-option [-agosquw] [-t target-session|target-window] option [value]
知道怎么做吗?

这与您选择的前缀是 C-\ 有关。 '\' 字符用于指示下一行是 set-option 命令的延续。在 C-\ 或引用 C-\ 之后添加一个空格,如此处解释:https://superuser.com/questions/417236/tmux-with-non-alphanumeric-prefix

您可以使用以下内容:

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