【问题标题】:Leaving tmux scrollback in terminal (iTerm2)在终端(iTerm2)中留下 tmux 回滚
【发布时间】:2012-10-03 15:39:19
【问题描述】:

通常tmux 只会显示与我的终端当前显示的行数一样多的输出。然后当我分离它时,它会清除它的所有内容。我知道如何查看回滚(ctrl+A[k,...),但是如何配置 tmux 以将其所有输出打印到终端,就好像我根本没有使用它一样?

我喜欢tmux,因为我很难记住nohup 某些任务,并且因为它使查看长时间运行的作业的输出变得更容易。但我希望能够更自然地查看它的回滚,只需在 iTerm2 中回滚

或者,如果screen 有办法做到这一点,我也可以使用。

【问题讨论】:

  • 马克,这个问题的标题是“我如何在 tmux 中滚动”。我知道如何在 tmux 中滚动。在我的问题中,我说我知道如何在 tmux 中滚动。我看不出该问题的哪些答案解决了我在终端中保留 tmux 缓冲区的问题。

标签: ssh tmux gnu-screen tty iterm


【解决方案1】:

iTerm2 build 1.0.0.20130302 有一个首选项,即使存在所谓的硬状态行,它也能捕获回滚:

为我工作,使用tmux v1.8 测试。

【讨论】:

  • 选中的那个选项解决了我的突出问题/想坚持使用 tmux。伟大的。现在我会再坚持一次 tmux。
  • 好吧,它适用于窗口,但不适用于窗格。是否有任何选项可以获得相同的功能?
  • 仅供参考,这似乎也适用于 screenhardstatus on,谢谢!
【解决方案2】:

我在 Superuser.com 上偶然发现了另一种解决方案:Use terminal scrollbar with tmux。将此添加到您的~/.tmux.conf

# Pretend our terminal doesn't support alternative screens, and thus all text 
# should be placed into the scrollback buffer when it goes off the top of the 
# screen.
#
# https://superuser.com/questions/310251/use-terminal-scrollbar-with-tmux
set-option -ga terminal-overrides ',xterm*:smcup@:rmcup@'

适用于 gnome-terminal v3.4.1.1 和 tmux v1.9

【讨论】:

  • 这对我也很有效。我还需要将set-window-option -g mouse-mode off 添加到我的.tmux.conf
  • @Ben 你可能指的是mode-mouse,而不是mouse-mode。您的建议会在我的系统上生成 unknown option: mouse-mode
【解决方案3】:

将此添加到您的~/.tmux.conf,您只需滚动即可进入复制模式:

setw -g mode-mouse on

您可能还想启用其他鼠标功能:

set -g mouse-resize-pane on
set -g mouse-select-pane on
set -g mouse-select-window on

查看这些功能的精彩文章:http://tangledhelix.com/blog/2012/07/16/tmux-and-mouse-mode/

【讨论】:

  • 仅供参考,这些选项已捆绑并重命名为 set -g mouse on
【解决方案4】:

就我而言,只需将set-option -g status off 放入.tmux.conf 即可将回滚留在终端中。但是你失去了状态栏。

【讨论】:

    猜你喜欢
    • 2022-06-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-01-12
    • 2016-01-28
    • 2020-07-05
    • 2012-04-18
    • 1970-01-01
    相关资源
    最近更新 更多