Tmux 键绑定问题

Mor*_*rne 8 command-line tmux

我已经从使用 screen 切换回使用 tmux。我有一个 tmux 配置,它使用屏幕的Ctrl+a序列,而不是 tmux 的默认Ctrl+ b

但是,我发现的一个问题是,如果我按 ctrl-a 然后在前一个屏幕上按 p,或在下一个屏幕上按 n,而没有释放 ctrl 键,tmux 会忽略键序列。如果我按Ctrl+ a,松开Ctrl,然后按np,它工作正常。

关于可能出什么问题的任何想法?我的配置如下:

# $Id: t-williams.conf,v 1.1 2009/11/02 18:59:28 nicm Exp $
#
# ~/.tmux.conf - tmux terminal multiplexer config
# Thayer Williams (http://cinderwick.ca)
# "Feel free to do whatever you like with it."

# set prefix key to ctrl+a
unbind C-b
set -g prefix C-a

# send the prefix to client inside window (ala nested sessions)
bind-key a send-prefix

# toggle last window like screen
bind-key C-a last-window

# confirm before killing a window or the server
bind-key k confirm kill-window
bind-key K confirm kill-server

# toggle statusbar
bind-key b set-option status

# ctrl+left/right cycles thru windows
bind-key -n C-right next
bind-key -n C-left prev

# open a man page in new window
bind / command-prompt "split-window 'exec man %%'"

# switch split window keys
unbind %
bind | split-window -h
bind - split-window -v

# quick view of processes
bind '~' split-window "exec htop"

# scrollback buffer n lines
set -g history-limit 10000

# listen for activity on all windows
#set -g bell-action any
setw -g monitor-activity off
set -g visual-activity off

# on-screen time for display-panes in ms
set -g display-panes-time 2000

# start window indexing at one instead of zero
set -g base-index 1

# enable wm window titles
set -g set-titles on

# Automatically set window title
setw -g automatic-rename

# statusbar --------------------------------------------------------------

set -g display-time 2000

# default statusbar colors
set -g status-fg white
set -g status-bg cyan
set -g status-attr default

# default window title colors
set-window-option -g window-status-fg black
set-window-option -g window-status-bg cyan
set-window-option -g window-status-attr default

# active window title colors
set-window-option -g window-status-current-fg white
set-window-option -g window-status-current-bg black
set-window-option -g window-status-current-attr bright

# command/message line colors
set -g message-fg blue
set -g message-bg white
set -g message-attr dim

# center align the window list
set -g status-justify centre

# show some useful 
set -g status-left "[#[fg=black]#H#(uptime | cut -d ',' -f 3- | sed -e 's/ load average: //' | sed -e 's/  / /g')#[default]]"
set -g status-left-length 50
set -g status-right "[#[fg=black]%a %Y-%m-%d %H:%M#[default]]"
set -g status-right-length 50

set -g default-terminal "screen"
Run Code Online (Sandbox Code Playgroud)

Mor*_*rne 7

我找到了模拟屏幕下原始行为的解决方案(仅包括配置的相关部分,其余部分只是装饰):

# set prefix key to ctrl+a until I have time to adapt
unbind C-b
set -g prefix C-a

# send the prefix to client inside window (ala nested sessions)
bind-key a send-prefix

# toggle last window like screen
bind-key C-a last-window

# navigate through windows like screen
bind-key C-a-n next
bind-key C-a-p prev
Run Code Online (Sandbox Code Playgroud)

将密钥序列直接链接在一起是解决方案。我没有意识到您实际上可以这样做,但它运行良好,而且我仍然可以保留发送前缀选项(我担心这是问题的一部分)。