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


当前回答

在屏幕上,你必须首先进入“滚动模式”(或“复制模式”),才能在滚动缓冲区中滚动:组合键Ctrl-a Esc,或Ctrl-a Ctrl-[。然后,您可以使用上下键(或Ctrl-b, Ctrl-f来移动页面)滚动历史记录。

在这种模式下,你的鼠标滚轮也应该工作,如果它在其他应用程序中工作的话。 “scrollback mode”以Esc结束。

至于在不首先进入滚动模式的情况下滚动滚动滚动缓冲区,如果不修改屏幕,这可能是不可能的。除了滚动模式之外,我从未听说过访问滚动缓冲区的方法。

其他回答

在屏幕上,你必须首先进入“滚动模式”(或“复制模式”),才能在滚动缓冲区中滚动:组合键Ctrl-a Esc,或Ctrl-a Ctrl-[。然后,您可以使用上下键(或Ctrl-b, Ctrl-f来移动页面)滚动历史记录。

在这种模式下,你的鼠标滚轮也应该工作,如果它在其他应用程序中工作的话。 “scrollback mode”以Esc结束。

至于在不首先进入滚动模式的情况下滚动滚动滚动缓冲区,如果不修改屏幕,这可能是不可能的。除了滚动模式之外,我从未听说过访问滚动缓冲区的方法。

我相信你可以在~/.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

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

[vimrc。]

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

如果上面的答案不适合你,请确保你没有在.screenrc中设置标题或alwayslastline选项。如果你有它们,这将不起作用:

termcapinfo xterm* ti@:te@

如果需要这些信息,可以尝试在终端的标题中设置它(使用termcapinfo)

按Ctrl+a + [

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

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

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