tmux设置-g鼠标模式不起作用

我一直在环顾四周,人们说,把

set -g mouse-mode on 

应该让你在运行tmux时滚动terminal输出。 但是,在将这个放在我的~/.tmux.conf文件中,并且在tmux会话~/.tmux.conf tmux set -g mouse-mode on ,没有任何变化。 当我滚动我仍然得到tmux以外的默认设置在vim滚动。

任何人都知道这是为什么?

所以这个选项已经在2.1版中更名了(2015年10月18日)

从更新日志 :

  Mouse-mode has been rewritten. There's now no longer options for: - mouse-resize-pane - mouse-select-pane - mouse-select-window - mode-mouse Instead there is just one option: 'mouse' which turns on mouse support 

所以这就是我现在在我的.tmux.conf文件中使用的

 set -g mouse on 

正如@ Graham42指出的那样,鼠标选项在版本2.1中已经改变。 现在滚动需要您先进入复印模式。 要使滚动与2.1之前的滚动几乎相同,请在.tmux.conf添加以下.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 

这将启用滚动hover在窗格上,您将能够逐行滚动该窗格。

来源: https : //groups.google.com/d/msg/tmux-users/TRwPgEOVqho/Ck_oth_SDgAJ

对于那些现在正在失去理智的人来说,快速提醒一下:

https://github.com/tmux/tmux/blob/310f0a960ca64fa3809545badc629c0c166c6cd2/CHANGES#L12

所以这只是

  :setw -g mouse 

这应该工作:

 setw -g mode-mouse on 

然后资源,然后configuration文件

 tmux source-file ~/.tmux.conf 

或者杀死服务器

正如@ Graham42所说,从版本2.1开始,鼠标选项已被重命名,但是您可以使用任何版本的tmux添加到〜/ .tmux.conf中的鼠标:

 is_older="[[ $(tmux -V | cut -d' ' -f2) -lt 2.1 ]] && true || false" if-shell "$is_older" "set -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" 

希望这可以帮助