tmux 在启动时输出“未知命令:复制模式”

tmux 在启动时输出“未知命令:复制模式”

我的 .tmux.conf 如下所示:

# enable aliases in tmux
set-option -g default-command /bin/bash
bind-key -n C-a send-prefix

# split panes using | and -
bind | split-window -h
bind - split-window -v
unbind '"'
unbind %

# Scroll using PgUp and PgDown
bind -temacs-edit -n PageUp copy-mode -u
bind -temacs-copy -n PageUp halfpage-up
bind -temacs-copy -n PageDown halfpage-down

# reload config file
bind r source-file ~/.tmux.conf

# switch panes using Alt+Arrowkeys
bind -n M-Left select-pane -L
bind -n M-Right select-pane -R
bind -n M-Up select-pane -U
bind -n M-Down select-pane -D

# enable mouse-mode
set -g mouse-select-window on
set -g mouse-select-pane on
set -g mode-mouse on

# rename windows automatically - will be changed eventually
set-option -g allow-rename on

# set the first window index to 1 to match keyboard layout
set -g base-index 1

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

# Ctrl+Pg(Up/Down) to switch windows
bind-key -n C-PageDown select-window -t :+
bind-key -n C-PageUp select-window -t :-

# No delay for escape key press
set -sg escape-time 0

# THEME
set -g status-bg blue
set -g status-fg white
set -g window-status-current-bg blue
set -g window-status-current-fg white
set -g window-status-current-attr bold
set -g status-interval 15
set -g status-left-length 30
set -g status-left '#[fg=yellow][#(whoami)@#(uname -n)]'
set -g status-right '#[fg=yellow]#(cut -d " " -f 1-3 /proc/loadavg)#[default] #[fg=white]%H:%M#[default]'

根据各种来源,包括 tmux 手册页,命令“copy-mode”应该可以让 tmux 进入复制模式。但由于某种原因,这不起作用:打开 tmux 时出现错误/home/max/.tmux.conf:12: unknown command: copy-mode,尝试使用 PageUp-Key 进入复制模式时(使用该nmap命令向控制台发送垃圾邮件后),什么也没发生。但是,在复制模式下,我可以使用 PageUp-Key 向上跳半页。

答案1

copy-mode要通过按PgUp(不带前缀)输入,您需要这个:

bind-key -T root PageUp copy-mode -u

从联机帮助页部分bind-key

根表用于按下的键无前缀键:将“c”绑定到根表中的新窗口(不推荐)意味着普通的“c”将创建一个新窗口。-n 是 -T root 的别名。

相关内容