tmux 上滚
by Alexey Samoshkin
通过阿列克谢·萨莫什金(Alexey Samoshkin)
实践中的tmux:回滚缓冲区 (tmux in practice: the scrollback buffer)
终端和tmux回滚缓冲区之间的区别,以及如何调整tmux行为的复制模式,滚动和鼠标选择。 (The difference between terminal and tmux scrollback buffers, and how to tweak copy mode, scroll, and mouse selection of tmux behavior.)
This is 3rd part of my tmux in practice article series.
这是我的tmux实践文章系列的第3部分。
Usually terminal emulators implement scrollback buffer, so you can explore past output, when it moves out of view. tmux, like other full-screen terminal applications like vim, runs in so-called alternate screen buffer of a parent terminal. Alternate buffer has exact width and height dimensions as physical window size.
通常,终端仿真器会实现回滚缓冲区,因此当移出视图时,您可以浏览过去的输出。 像vim等其他全屏终端应用程序一样,tmux在父终端的所谓备用屏幕缓冲区中运行。 备用缓冲区具有与物理窗口大小相同的宽度和高度尺寸。
There are several effects of using alternate buffer:
使用备用缓冲区有几种效果:
- Any output, that exceeds visible part of alternate buffer, is lost. As soon as lines go out of view, they are lost. To prevent history loss, tmux implements it’s own “inner” scrollback buffer. The consequence of this is that you cannot work with tmux inner scrollback same as you usually do within your terminal. 任何超出备用缓冲区可见部分的输出都将丢失。 一旦视线消失,它们就会丢失。 为了防止历史记录丢失,tmux实现了它自己的“内部”回滚缓冲区。 这样的结果是,您无法像在终端机中一样使用tmux内部回滚。
- Any output produced inside tmux (the same is true for vim, nano, man, less, and so on) does not spill over into the outer terminal’s scrollback history. When you close your full-screen app, you get back to the same state when you launched the app and don’t see output from inside the app any more. tmux内部产生的任何输出(vim,nano,man,less等的情况也是如此)不会溢出到外部终端的回滚历史记录中。 关闭全屏应用程序时,启动应用程序时会回到相同的状态,并且不再看到应用程序内部的输出。
In practice, if you get used to scroll back using ⌘↑
in your iTerm and if you’re going to do the same inside running tmux session, you will control and scroll the outer iTerm’s scrollback buffer, rather than the tmux’s inner scrollback buffer.
实际上,如果您习惯在iTerm中使用⌘↑
向后滚动,并且如果要在运行tmux会话中执行相同的操作,则将控制并滚动外部iTer