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

set -g mouse-mode on

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


当前回答

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

其他回答

您仍然可以使用魔鬼逻辑设置选项取决于您当前的Tmux版本:请参阅我之前的回答。

但是自从Tmux v1.7以来,set-option添加了“-q”来屏蔽错误,不打印任何东西(参见changelog)。 我建议使用这个功能,它更易于阅读和扩展。

把这个添加到你的~/.tmux.conf:

# from v2.1
set -gq mouse on
# before v2.1
set -gq mode-mouse on
set -gq mouse-resize-pane on
set -gq mouse-select-pane on
set -gq mouse-select-window on

重新启动tmux或源文件新的.tmux.conf


旁注:如果人们更喜欢这个答案,我愿意删除我的旧答案

试试这个。它在我的电脑上运行。

set -g mouse on

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

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

这应该可以工作:

setw -g mode-mouse on

然后资源,然后配置文件

tmux source-file ~/.tmux.conf

或者关闭服务器