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

系统教程 行业动态 更新时间:2024-06-14 16:57:39
使用tmux在终端中滚动和选择鼠标(Mouse scrolling and selection in terminal with tmux)

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

对我来说这是一个很大的转折点。 如何使用tmux进行终端滚动?

PS。 我知道我可以使用set-window-option -g mode-mouse on来使用鼠标滚轮滚动tmux缓冲区 - 而不是 终端缓冲区。 这个设置的另一个副作用是我不能再按常规方式选择鼠标 - 我必须用鼠标左键按Shift键。

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

PPS。 Ubuntu 15.10; 侏儒末端; 滚动条在右侧清晰可见,但在screen下,它们表示只显示缓冲区的一小部分,而在tmux下,它们表示没有可滚动的内容。

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.

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

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: how do I tell tmux to pass all mouse events to the terminal emulator?

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接管鼠标和键。

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

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

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

注意:如果您使用termcap而不是terminfo,请使用ti和te而不是smcup / rmcup 。

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 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@'

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.

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

更多推荐

本文发布于:2023-04-13 12:06:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/dzcp/c3f8718ebf6464e5555d3625334321c4.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:鼠标   终端   tmux   Mouse   terminal

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!