为了允许用鼠标滚动tmux窗格,我在~/.tmux.conf文件中放入了以下内容:

set -g mouse-mode on

然而,什么都没有改变。当我滚动时,它仍然在tmux之外滚动。为什么会这样?


当前回答

因此该选项已在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

其他回答

这应该可以工作:

setw -g mode-mouse on

然后资源,然后配置文件

tmux source-file ~/.tmux.conf

或者关闭服务器

给那些现在正失去理智的人一个快速提醒:

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

这就是

:setw -g mouse

Ctrl + B,然后设置鼠标。-g不再需要。

因此该选项已在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中添加以下内容。

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