如何设置GNU屏幕以允许鼠标滚轮在滚动缓冲区中滚动?我试着谷歌关于这一点,但大多数点击是关于如何允许屏幕内的应用程序使用滚轮。


当前回答

我相信你可以在~/.screenrc中添加这样一行:

termcapinfo xterm* ti@:te@

其中“xterm*”是当前TERM的glob匹配。为了确认它的工作,^A^D从屏幕分离,然后screen -d -r重新连接,然后ls几次,并尝试向后滚动。这对我很管用。


这是什么魔法?好吧,让我们查阅一下手册。

屏幕(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.

从termcap (5):

String capabilities
    [..]
    te   End program that uses cursor motion
    ti   Begin program that uses cursor motion

其他回答

对于OS X (Snow Leopard),以下操作对我来说是有效的:

http://slaptijack.com/system-administration/mac-os-x-terminal-and-gnu-screen-scrollback/

简单地说,它包括向~/添加以下内容。远程主机上的Screenrc(你正在运行的屏幕):

defscrollback 5000
termcapinfo xterm* ti@:te@

以下是我在Cygwin和Putty中使用的: 编辑.screenrc并添加

terminfo xterm* ti=:te=

在GNU屏幕内的VIM中使用滚轮:

[vimrc。]

set mouse=a             " hold shift to copy xterm
set ttymouse=xterm2     " necessary for gnu screen & mouse

我相信你可以在~/.screenrc中添加这样一行:

termcapinfo xterm* ti@:te@

其中“xterm*”是当前TERM的glob匹配。为了确认它的工作,^A^D从屏幕分离,然后screen -d -r重新连接,然后ls几次,并尝试向后滚动。这对我很管用。


这是什么魔法?好吧,让我们查阅一下手册。

屏幕(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.

从termcap (5):

String capabilities
    [..]
    te   End program that uses cursor motion
    ti   Begin program that uses cursor motion

按Ctrl+a + [

终端的标题栏现在应该显示“复制模式”。

现在方向键和鼠标滚轮应该可以正常工作了。

按“Esc”或连续按“Enter”键恢复正常。