Linux 如何使用鼠标滚轮在 tmux 面板中启用滚动?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/7798103/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-05 06:43:19  来源:igfitidea点击:

How to enable scrolling in tmux panels with mouse wheel?

linuxtmux

提问by mart7ini

Need to enable scrolling into tmux panels with mouse wheel. How can I get that tips? Can I use it (if its exist of course) with mouse-select-pane onoption?

需要使用鼠标滚轮滚动到 tmux 面板。我怎样才能得到这些提示?我可以使用它(如果它当然存在的话)和鼠标选择窗格选项吗?

采纳答案by dm4

Origin Answer (deprecated)

Try this:

setw -g mode-mouse on

原始答案(已弃用)

尝试这个:

setw -g mode-mouse on

It can be used with the mouse-select-pane onand mouse-select-window onoptions.

它可以与mouse-select-pane onmouse-select-window on选项一起使用。

Update

更新

After tmux 2.1, mode-mouseoption is no longer available. You should now use:

在 tmux 2.1 之后,mode-mouse选项不再可用。你现在应该使用:

set -g mouse on

to capture mouse event.

捕获鼠标事件。

回答by Anil G

From https://blogs.oracle.com/samf/entry/smcup_rmcup_hate

来自https://blogs.oracle.com/samf/entry/smcup_rmcup_hate

In .tmux.conf:

在 .tmux.conf 中:

set -g terminal-overrides 'xterm*:smcup@:rmcup@'

where, for instance, mouse scrolling in vim in tmux scrolls vim, NOT tmux history. Very beneficial, and VERY different from history scrolling.

例如,鼠标在 tmux 中的 vim 中滚动会滚动 vim,而不是 tmux 历史记录。非常有益,并且与历史滚动非常不同。

回答by Intentss

For Mac OSX 10.9

对于 Mac OSX 10.9

First Install SimpleSIMBL

首先安装SimpleSIMBL

Then Install MouseTerm

然后安装MouseTerm

Add this to your ~/.tmux.conf

将此添加到您的 ~/.tmux.conf

set-option -g mouse-select-pane on
set-option -g mouse-select-window on
set-window-option -g mode-mouse on

For VIM Scrolling add this to your ~/.vimrc

对于 VIM 滚动,将此添加到您的 ~/.vimrc

set mouse=a
set ttymouse=xterm

Notes: see also: Scrolling inside Vim in Mac's Terminal

注意:另请参阅:在 Mac 终端中的 Vim 内滚动

回答by daniel

There are some changes for Tmux 2.1

Tmux 2.1 有一些变化

  • 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 entirely.

  • 鼠标模式已被重写。现在不再有以下选项:

    • 鼠标调整面板
    • 鼠标选择面板
    • 鼠标选择窗口
    • 模式鼠标

    相反,只有一种选择:“鼠标”,它完全打开鼠标支持。

So set -g mouse on

所以 set -g mouse on

Update:

更新:

I have to use this script to make scrolling work again: https://github.com/NHDaly/tmux-scroll-copy-mode

我必须使用此脚本再次使滚动工作:https: //github.com/NHDaly/tmux-scroll-copy-mode