在 iTerm2 中重现 Terminal.app 到上一个提示的回滚

Reproducing Terminal.app's scrollback to previous prompt in iTerm2

默认情况下 Terminal.app 具有 + 的键绑定,可将屏幕滚动回(并短暂突出显示)上一个命令提示符。 (这似乎与 shell 无关,尽管我只尝试了几次。我正在使用 bash。)

我试图在 iTerm2 中获得类似的行为,但我还没有找到可以做到这一点的映射。 None 我在 iTerm2 的键映射列表中尝试过的搜索词中有类似此功能的建议。名为 Terminal.app Compatibility 的 iTerm2 映射预设导致 + 滚动以前的命令,方式相同 会,而不是 window 滚动回先前输入命令的行。

基于this answer to a similar question, I looked through the output of bind -p and see entries "\e[A": previous-history and "\e[B": next-history, but these seem to be describing the scrolling through previously-entered commands rather than scrolling through the entire terminal window output to the prompt at which the command was input. These are the only bind -p entries that refer to up or down arrows (if my assumption is correct that [A refers to the up arrow, which I determined with xxd -psd as suggested in this answer.

Terminal.app 中的这种行为是键绑定的结果吗?或者,我将如何确定它是否存在?有没有办法让 iTerm2 复制这种行为?

你试过了吗 fn + CMD + UpArrow ?

只是 Terminal.app “一次提示一个提示” 行为的替代品,但可能会有所帮助,因为它使 iTerm2 在我的自定义配置文件和各种键映射首选项中始终如一地执行 Full Page Up

安装shell integration后,iTerm2会在每次提示时创建一个“标记”,移动到上一个标记的默认快捷方式是++.