较少的输出在退出后不显示在终端中


10

以前,如果我运行something | less,然后按q,它通常使我返回到提示,输出less仍然可见。

$ seq 1 100 | less
1
2
3
4
:q
$ <prompt here. I can still see the output of less>

但是现在,我安装了Zsh(使用oh-my-zsh。它在bash中也不起作用)之后,终端看起来像这样:

$ seq 1 100 | less
<less shows up, I press :q and it is cleared>
$ <prompt here. Output of less disappears.>

我搜索了一个less配置文件,但没有找到。有什么办法可以让我less表现出以前的方式?使输出可见非常方便。

Answers:


8
seq 1 100 | less -X

看:少人

-X or --no-init
Disables  sending  the  termcap  initialization and deinitialization strings to the terminal. 
This is sometimes desirable if the deinitialization string does something  unnecessary, like clearing the screen.

谢谢,就是这样!我把它添加到~/.lesskey它的所有运行git
Abdulsattar穆罕默德

8

正如jhscheer所提到的,所有内容都在手册页中 less

将此添加到您的zsh配置文件中.zshrc,使其与git一起使用时效果很好:)

LESS="-XRF"; export LESS

-编辑

实际上,根据您的情况,最好运行以下命令以避免修改的全局行为less

git config --global core.pager 'less -XRF'

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.