Jes*_*erE 246 gnu-screen mousewheel
如何设置GNU屏幕以允许鼠标滚轮在回滚缓冲区中滚动?我试图谷歌这个,但大多数点击如何允许屏幕内的应用程序使用滚轮.
Pis*_*tos 340
我相信你可以在这里添加这样的一行~/.screenrc
:
termcapinfo xterm* ti@:te@
Run Code Online (Sandbox Code Playgroud)
其中"xterm*"是您当前TERM的全局匹配.要确认它有效,^ A ^ D要从屏幕上分离,然后screen -d -r
重新连接,然后ls
几次,然后尝试向后滚动.这个对我有用.
这个魔法是什么?好吧,让我们查阅手册页.
screen(1)
说:
termcapinfo term terminal-tweaks [window-tweaks]
[..]
The first argument specifies which terminal(s) should be affected by this
definition. You can specify multiple terminal names by separating them with
`|'s. Use `*' to match all terminals and `vt*' to match all terminals that
begin with "vt".
[..]
Some examples:
termcap xterm* LP:hs@
Informs screen that all terminals that begin with `xterm' have firm
auto-margins that allow the last position on the screen to be updated (LP),
but they don't really have a status line (no 'hs' - append `@' to turn
entries off). Note that we assume `LP' for all terminal names that start
with "vt", but only if you don't specify a termcap command for that terminal.
Run Code Online (Sandbox Code Playgroud)
来自termcap(5)
:
String capabilities
[..]
te End program that uses cursor motion
ti Begin program that uses cursor motion
Run Code Online (Sandbox Code Playgroud)
sle*_*ske 68
在屏幕中,您必须先进入"回滚模式"(或"复制模式")才能在回滚缓冲区中滚动:键组合Ctrl- a Esc或Ctrl- a Ctrl- [.然后,您可以使用向上和向下键(或Ctrl- b,Ctrl- f移动页面)滚动历史记录.
在该模式下,如果鼠标滚轮适用于其他应用程序,它也应该可以正常工作.你结束了"回滚模式" Esc.
至于在没有先进入回滚模式的情况下滚动回滚缓冲区,如果不修改屏幕则可能无法实现.除了回滚模式之外,我从未听说过访问回滚缓冲区的方法.
Tom*_* R. 24
Jon Z所指的优秀文章已不再可用,但我能够从Google缓存中获取纯文本版本.我将它保存在这里以防Google将来放弃它.MikaelStåldal的原始帖子是信用到期的信用.
-
如何在GNU Screen中使用鼠标滚轮
GNU Screen支持回滚,但默认情况下你必须使用笨键才能使用它.我希望能够使用Shift-PageUp,Shift-PageDown和鼠标滚轮进行滚动,就像在xterm中一样.
为此配置Screen并不容易,它涉及与终端仿真器的合作.但我终于设法实现了一个非常好的解决方案.将其添加到〜/ .Xresources文件中(您需要注销才能生效):
XTerm*saveLines: 0
XTerm*vt100.translations: #override \n\
Ctrl <Btn4Down>: string(0x1b) string("[25S") \n\
Lock Ctrl <Btn4Down>: string(0x1b) string("[25S") \n\
Lock @Num_Lock Ctrl <Btn4Down>: string(0x1b) string("[25S") \n\
@Num_Lock Ctrl <Btn4Down>: string(0x1b) string("[25S") \n\
<Btn4Down>: string(0x1b) string("[5S") \n\
Ctrl <Btn5Down>: string(0x1b) string("[25T") \n\
Lock Ctrl <Btn5Down>: string(0x1b) string("[25T") \n\
Lock @Num_Lock Ctrl <Btn5Down>: string(0x1b) string("[25T") \n\
@Num_Lock Ctrl <Btn5Down>: string(0x1b) string("[25T") \n\
<Btn5Down>: string(0x1b) string("[5T") \n\
Shift <KeyPress> Prior: string(0x1b) string("[25S") \n\
Shift <KeyPress> Next: string(0x1b) string("[25T") \n
Run Code Online (Sandbox Code Playgroud)
然后将其添加到〜/ .screenrc文件中:
defscrollback 1000
# Scroll up
bindkey -d "^[[5S" eval copy "stuff 5\025"
bindkey -m "^[[5S" stuff 5\025
# Scroll down
bindkey -d "^[[5T" eval copy "stuff 5\004"
bindkey -m "^[[5T" stuff 5\004
# Scroll up more
bindkey -d "^[[25S" eval copy "stuff \025"
bindkey -m "^[[25S" stuff \025
# Scroll down more
bindkey -d "^[[25T" eval copy "stuff \004"
bindkey -m "^[[25T" stuff \004
Run Code Online (Sandbox Code Playgroud)
这适用于xterm.我不确定它是否适用于其他终端仿真器.
请注意,这会禁用xterm中的正常滚动支持,您只能在使用Screen时滚动.您可能希望像这样启动xterm以始终使用Screen:
xterm -e screen
Run Code Online (Sandbox Code Playgroud)
Jes*_*sen 13
对于OS X(Snow Leopard),以下内容对我有用:
http://slaptijack.com/system-administration/mac-os-x-terminal-and-gnu-screen-scrollback/
简而言之,它涉及将以下内容添加到远程主机上的〜/ .screenrc(您正在运行的屏幕上):
defscrollback 5000
termcapinfo xterm* ti@:te@
Run Code Online (Sandbox Code Playgroud)
小智 11
并在GNU屏幕内的VIM中使用滚轮:
[的.vimrc]
set mouse=a " hold shift to copy xterm
set ttymouse=xterm2 " necessary for gnu screen & mouse
Run Code Online (Sandbox Code Playgroud)
小智 11
以下内容在 Cygwin 和 Putty 中都对我有用:编辑 .screenrc 并添加
terminfo xterm* ti=:te=
Run Code Online (Sandbox Code Playgroud)
将TERM
变量设置为vt100
而不是xterm
在运行 screen 之前也有效。
我已经使用这个很长时间了,就像一个魅力。
将此添加到您的.bashrc
:
# make scrollbar / wheel scrolling work when running screen in gnome-terminal (or other)
if [ "$TERM" = "xterm" ]; then
export TERM=vt100
fi
Run Code Online (Sandbox Code Playgroud)
——
作为参考,我.screenrc
有这个(这个 AFAIK 不需要):
# Extend the vt100 desciption by some sequences.
termcap vt100* ms:AL=\E[%dL:DL=\E[%dM:UP=\E[%dA:DO=\E[%dB:LE=\E[%dD:RI=\E[%dC
terminfo vt100* ms:AL=\E[%p1%dL:DL=\E[%p1%dM:UP=\E[%p1%dA:DO=\E[%p1%dB:LE=\E[%p1%dD:RI=\E[%p1%dC
Run Code Online (Sandbox Code Playgroud)
小智 5
使用“Ubuntu 16.04.2 LTS”时的解决方案如下:
A)。按照之前的答案指定更新$HOME/.screenrc :
termcapinfo xterm* ti@:te@
Run Code Online (Sandbox Code Playgroud)
b). 使用“设置”-“首选应用程序”,通过在下拉列表中选择“X 终端”将默认终端更改为 xterm。
一些多余的注释
即使我将 termcapinfo 行更改为“*”而不是“xterm*”,其他终端(包括安装“lxterminal”)都不适合我。
通过单击屏幕左上角的菜单按钮,您可以使用右下角的第三个图标打开“设置”对话框。