Mac 终端显示缓冲区末尾
当我调用像 man 这样的命令时,它会将所有内容放入缓冲区中,并且一次只显示一页。我可以使用箭头键或空格键进行导航,但我希望它能够立即显示所有内容,而无需滚动浏览。我需要做什么才能改变它?我很确定这是一些按键绑定,但我无法弄清楚。
如果它只是自动滚动到末尾,我会更喜欢它。如果我可以输入一些命令使其自动执行此操作,请告诉我。如果我必须使用按键绑定来使其向下滚动到缓冲区的末尾,或者将所有内容发送到 shell,请告诉我。
如果我正在进行按键绑定,我希望它是像 Shift/Command + Down 那样一直向下滚动。然后我可能会绘制一个类似的地图来返回。
谢谢。
When I call commands like man, it puts everything into a buffer and only shows one page at a time. I can navigate with my arrow keys or my space bar but I want it to show everything at once without me having to scroll through it. What do I need to do in order to change it? I'm pretty sure it's some key bind but I can't figure it out.
I would prefer it if it would simply just automatically scroll to the end. If there's some command I can enter to make it automatically do this, please let me know. If I have to use a key bind instead to make it scroll down to the end of the buffer, or send everything to the shell, then let me know.
If I'm doing a key bind, I'd prefer it to be something like shift/command + down to scroll all the way down. And then I'd probably map a similar one to go back up.
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
当您使用
man
时,它会通过寻呼机传送您的结果。如果您尚未配置它,则在 Mac 上这是/usr/bin/less -is
。绕过寻呼机的一种方法是将其设置为
ul
。例如:ul
是一个过滤器,可确保保留粗体和下划线。它们分别通过X^HX
和X^H_
以相当古老的方式进行编码,现代终端不支持这种方式;寻呼机通常自行将它们翻译成终端转义序列。对于
man
,还有其他几个选项:帮助菜单获取
手册
页。只需按
⇧⌘<代码>/
并输入您要访问的页面的名称
想要,然后从菜单中选择它(尽管我认为这使用了
不幸的是固定路径)。这
只需在新的终端窗口中运行
man -P ul
即可。另一个是渲染成
PostScript,OS X 可以转换
转换为 PDF,格式精美
如果需要的话可以打印。我去过
使用这个
zsh
函数多年:<前><代码> gman() {
PDF=/tmp/man.$$.pdf
打印“正在转换为 PDF...”
人 -t $@ | /usr/bin/pstopdf -i -o $PDF
打印“打开...”
打开$PDF
{ 睡觉 5; rm -f $PDF } &!
}
When you use
man
, it's piping your result through a pager. If you haven't configured it, on the Mac this is/usr/bin/less -is
.One way to bypass the pager is by setting it to
ul
. For example:ul
is a filter that ensures boldface and underlining are preserved. They're encoded in a rather archaic way byX^HX
andX^H_
respectively, which modern terminals don't support; pagers ordinarily translate these into terminal escape sequences by themselves.With
man
, there are a couple of other options:the Help menu to get
man
pages.Just press
⇧⌘
/
and type the name of the page you
want, then select it from the menu (although I think this uses a
fixed path unfortunately). This
just runs
man -P ul
for you in a new Terminal window.Another is to render into
PostScript, which OS X can convert
into a PDF, nicely formatted for
printing if you want. I've been
using this
zsh
function for years:将寻呼机更改为
cat
而不是默认值(在我的机器上为/usr/bin/less -is
)应该可以满足您的要求。从man(1)
手册页:因此,您可以执行
man -P catwhatever
,或者您可以将环境中的MANPAGER
和/或PAGER
设置为cat
并获得相同的行为。Changing the pager to
cat
instead of the default (/usr/bin/less -is
on my machine) should do what you want. From theman(1)
man page:So you can either do
man -P cat whatever
, or you can setMANPAGER
and/orPAGER
in your environment tocat
and get the same behaviour.less
分页器通常是大多数系统上的默认设置,它已经具有可直接转到输入的结尾和开头的键绑定:g
将转到输入的开头G
(实际上类似于Shift+g
,除非您在打开 Caps Lock 的情况下键入)将转到输入的末尾The
less
pager which is usually the default on most systems already has key bindings to go directly to the end and start of its input:g
will go to the start of the inputG
(which would actually be something along the lines ofShift+g
, unless you type with Caps Lock on) will go to the end of the input