使用tmux在终端中滚动鼠标和选择 [英] Mouse scrolling and selection in terminal with tmux

查看:166
本文介绍了使用tmux在终端中滚动鼠标和选择的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚从 GNU屏幕切换到了 tmux 2.0 ,我惊讶地发现我无法再使用鼠标滚轮和 Shift来滚动回终端历史记录了-PgUp / Shift-PgDn .

I just switched from GNU screen to tmux 2.0 and I was surprised to discover that I can no longer scroll back the terminal history using mouse wheel and Shift-PgUp/Shift-PgDn.

这对我来说是一个重大的关门.如何使用tmux 终端滚动?

This is a major turn off for me. How do I do terminal scrolling with tmux?

PS.我知道我可以 set-window-option -g mode-mouse on 来使用鼠标滚轮滚动浏览 tmux 缓冲区- 终端缓冲区.此设置的另一个副作用是,我无法再按通常的方式进行鼠标选择-我必须用鼠标左键按下 Shift .

PS. I am aware that I can do set-window-option -g mode-mouse on to use the mouse wheel to scroll through the tmux buffer - not the terminal buffer. Another side effect of this setting is that I can no longer do mouse selection the usual way - I have to press Shift with the left mouse button.

IOW:我如何告诉tmux将所有鼠标事件传递给终端仿真器?

PPS.Ubuntu 15.10;gnome-terminal;滚动条在右侧清晰可见,但是在 screen 下,它们指示仅显示了缓冲区的一小部分,而在 tmux 下,它们指示没有任何内容可进行.滚动.

PPS. Ubuntu 15.10; gnome-terminal; the scroll bars are clearly visible on the right, but under screen they indicate that only a small part of the buffer is shown, while under tmux they indicate that there is nothing to scroll.

推荐答案

我怀疑您的问题实际上是根本没有将行放置在回滚缓冲区中,而不是tmux接管了鼠标和键.

I suspect your issue is actually that lines aren't being placed in the scrollback buffer at all, rather than tmux taking over the mouse and keys.

默认情况下,Tmux使用备用屏幕缓冲区"(您可能会注意到,如果屏幕上有文本,然后附加和分离tmux,文本将返回).许多终端仿真器不会将在此模式下滚动或擦除的文本放在回滚缓冲区中.要禁用此功能,请执行以下操作:

Tmux by default uses the "alternate screen buffer" (you may notice that if you have text on the screen, then attach and detach tmux, the text will come back). Many terminal emulators will not place text that is scrolled or erased in this mode in the scrollback buffer. To disable this, do this:

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

其中 xterm * 是终端在$ TERM环境变量中报告的内容.如果以交互方式设置选项,则可能需要拆下,重置终端并重新连接,以使其正常工作.

Where xterm* is whatever your terminal reports itself as in the $TERM environment variable. You may need to detach, reset the terminal, and reattach, to have it work if you set the option interactively.

注意:如果使用termcap代替terminfo,请使用 ti te 代替 smcup / rmcup

NOTE: If you use termcap instead of terminfo, use ti and te instead of smcup/rmcup.

这篇关于使用tmux在终端中滚动鼠标和选择的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆