默认情况下,Terminal.app 有一个键绑定⌘</kbd>+↑</kbd> that scrolls the screen back to (and briefly highlights) the previous command prompt. (This seems to be independent of shell although I've only tried a couple. I'm using bash.)
我试图在 iTerm2 中获得类似的行为,但我还没有找到可以做到这一点的映射。我在 iTerm2 的键映射列表中尝试过的所有搜索词都没有暗示任何类似这个功能的东西。iTerm2 映射预设调用Terminal.app Compatibility
原因⌘</kbd>+↑</kbd> to scroll through previous commands, the same way ↑</kbd> does, rather than the window scrolling back to the lines on which previous commands were input.
基于this answer to a similar question,我查看了输出bind -p
并查看条目"\e[A": previous-history
和"\e[B": next-history
,但这些似乎描述了滚动先前输入的命令,而不是滚动整个终端窗口输出到命令所在的提示符输入。这些是唯一bind -p
引用向上或向下箭头的条目(如果我的假设是正确的,[A
则指的是向上箭头,我按照此答案xxd -psd
中的建议确定了向上箭头。
Terminal.app 中的这种行为是键绑定的结果吗?或者,我将如何确定它是否存在?有没有办法让 iTerm2 复制这种行为?