为了允许用鼠标滚动tmux窗格,我在~/.tmux.conf文件中放入了以下内容:
set -g mouse-mode on
然而,什么都没有改变。当我滚动时,它仍然在tmux之外滚动。为什么会这样?
为了允许用鼠标滚动tmux窗格,我在~/.tmux.conf文件中放入了以下内容:
set -g mouse-mode on
然而,什么都没有改变。当我滚动时,它仍然在tmux之外滚动。为什么会这样?
当前回答
正如@Graham42所说,从版本2.1鼠标选项已经重命名,但你可以使用鼠标与任何版本的tmux添加到你的~/.tmux.conf:
Bash shell:
is_pre_2_1="[[ $(tmux -V | cut -d' ' -f2) < 2.1 ]] && echo true || echo false"
if-shell "$is_pre_2_1" "setw -g mode-mouse on; set -g mouse-resize-pane on;\
set -g mouse-select-pane on; set -g mouse-select-window on" "set -g mouse on"
Sh(伯恩壳)壳:
is_pre_2_1="tmux -V | cut -d' ' -f2 | awk '{print ($0 < 2.1) ? "true" : "false"}'"
if-shell "$is_pre_2_1" "setw -g mode-mouse on; set -g mouse-resize-pane on;\
set -g mouse-select-pane on; set -g mouse-select-window on" "set -g mouse on"
希望这能有所帮助
其他回答
粘贴到~/.tmux.conf
set -g mouse on
在终端上运行
tmux source-file ~/.tmux.conf
给那些现在正失去理智的人一个快速提醒:
https://github.com/tmux/tmux/blob/310f0a960ca64fa3809545badc629c0c166c6cd2/CHANGES#L12
这就是
:setw -g mouse
正如@Graham42所指出的,鼠标选项在2.1版本中发生了变化。现在滚动需要您首先进入复制模式。要使滚动几乎与2.1之前相同,请在.tmux.conf中添加以下内容。
set-option -g mouse on
# make scrolling with wheels work
bind -n WheelUpPane if-shell -F -t = "#{mouse_any_flag}" "send-keys -M" "if -Ft= '#{pane_in_mode}' 'send-keys -M' 'select-pane -t=; copy-mode -e; send-keys -M'"
bind -n WheelDownPane select-pane -t= \; send-keys -M
这将使滚动悬停在一个窗格上,您将能够逐行滚动该窗格。
来源:https://groups.google.com/d/msg/tmux-users/TRwPgEOVqho/Ck_oth_SDgAJ
试试这个。它在我的电脑上运行。
set -g mouse on
这应该可以工作:
setw -g mode-mouse on
然后资源,然后配置文件
tmux source-file ~/.tmux.conf
或者关闭服务器