Tmux 命令不起作用

Tmux commands doesn't work

当我键入 ctrl+b(按住它们)按钮然后按下 c 按钮时,没有任何反应。没有 ctrl+b 命令组合起作用。只有这两个命令有效:

tmux new-session -s {session-name}
tmux kill-session -t {session-name}

我也无法创建新的嵌套会话。如何创建新会话。是否有像 vim 这样的使用 tmux 的模式?例如。点击 esc 进入 normal/command 模式,点击 i 进入插入模式,点击 v 进入可视模式。我问这个问题是因为我怀疑在给出像 ctrl+b+n 这样的键命令之前是否需要按某个键。它们只是在终端中作为普通文本写入。

终端输入字符。请参阅下面的屏幕截图。我正在使用来自 here

的所有 tmux、zsh、vim 配置

请检查我的 tmux.config 文件

set -g default-command "reattach-to-user-namespace -l zsh"
# tmux display things in 256 colors
set -g default-terminal "screen-256color"
set -g status-utf8 on

# automatically renumber tmux windows
set -g renumber-windows on

# unbind default prefix and set it to Ctrl+a
unbind C-b
set -g prefix C-a
bind C-a send-prefix

# for nested tmux sessions
bind-key a send-prefix

# Activity Monitoring
setw -g monitor-activity off
set -g visual-activity off

# Rather than constraining window size to the maximum size of any client
# connected to the *session*, constrain window size to the maximum size of any
# client connected to *that window*. Much more reasonable.
setw -g aggressive-resize on

# make delay shorter
set -sg escape-time 0

# make window/pane index start with 1
set -g base-index 1
setw -g pane-base-index 1

######################
#### Key Bindings ####
######################

# reload config file
bind r source-file ~/.tmux.conf \; display "Config Reloaded!"

# split window and fix path for tmux 1.9
bind | split-window -h -c "#{pane_current_path}"
bind - split-window -v -c "#{pane_current_path}"

# synchronize all panes in a window
bind y setw synchronize-panes

# pane movement shortcuts
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R

bind -r C-h select-window -t :-
bind -r C-l select-window -t :+

# Resize pane shortcuts
bind -r H resize-pane -L 10
bind -r J resize-pane -D 10
bind -r K resize-pane -U 10
bind -r L resize-pane -R 10

# enable mouse support for switching panes/windows
# NOTE: This breaks selecting/copying text on OSX
# To select text as expected, hold Option to disable it (iTerm2)
setw -g mode-mouse on
set -g mouse-select-pane on
set -g mouse-resize-pane on
set -g mouse-select-window on

# set vi mode for copy mode
setw -g mode-keys vi

# more settings to make copy-mode more vim-like
unbind [
bind Escape copy-mode
unbind p
bind p paste-buffer
bind -t vi-copy 'v' begin-selection
bind -t vi-copy 'y' copy-selection

# Buffers to/from Mac clipboard, yay tmux book from pragprog
bind C-c run "tmux save-buffer - | reattach-to-user-namespace pbcopy"
bind C-v run "tmux set-buffer $(reattach-to-user-namespace pbpaste); tmux paste-buffer"

您已更改配置中的默认转义序列:从 Ctrl-B(tmux 默认值)到 Ctrl-A(就像类似的终端多路复用器 screen)。

相关配置行在第三段:

# unbind default prefix and set it to Ctrl+a
unbind C-b
set -g prefix C-a
bind C-a send-prefix

如果你想使用 tmux 默认值,只需注释掉(带前导 #)或删除上面的行 tmux.conf.

我最近也在 Linux Mint 中遇到了同样的问题,但是 this 线程修复了它

对于垂直拆分:而不是 (Ctrl+B) + % => (Ctrl+B) + (Ctrl+%)

对于水平分割:而不是(Ctrl+B) + " => (Ctrl+B) + (Ctrl+")

此外,不要忘记在按下 (Ctrl+%) 或 (Ctrl+") 之前释放 (Ctrl+B)。