Dom*_*ski 2 terminal zsh git oh-my-zsh
我每天都将 zsh 与 oh-my-zsh 一起使用,但有一件小事困扰着我。如果我使用git log或任何其他类似的命令,则输出会占用整个终端窗口。按下后q输出被清除,我回到我的提示。
我希望输出保留在屏幕上。我可以配置什么来实现这一目标?
一张图片值一千个字,所以这是当前行为的 gif:
这是我的 .zshrc:
plugins=(
gitfast docker osx web-search cp
)
ZSH_THEME="powerlevel9k/powerlevel9k"
Run Code Online (Sandbox Code Playgroud)
看看你在core.pager下配置了什么。您可能已将其设置为less没有设置-X标志。设置该标志将不会less在退出时清除屏幕。
如果是这种情况,请转到~/.gitconfig并pager在该[core]部分下进行编辑。我有我的设置为-FRSX。
$ git config --get core.pager
less -FRSX
Run Code Online (Sandbox Code Playgroud)
为了您的方便,这是来自less描述每个标志含义的手册页:
-F or --quit-if-one-screen
Causes less to automatically exit if the entire file can be displayed on the first screen.
-R or --RAW-CONTROL-CHARS
Like -r, but only ANSI "color" escape sequences are output in "raw" form. Unlike -r, the screen appearance is maintained correctly in most cases. ANSI "color" escape sequences are sequences of the form:
ESC [ ... m
where the "..." is zero or more color specification characters For the purpose of keeping track of screen appearance, ANSI color escape sequences are assumed to not move the cursor. You can make less think that characters other than "m" can end ANSI
color escape sequences by setting the environment variable LESSANSIENDCHARS to the list of characters which can end a color escape sequence. And you can make less think that characters other than the standard ones may appear between the ESC and the m
by setting the environment variable LESSANSIMIDCHARS to the list of characters which can appear.
-S or --chop-long-lines
Causes lines longer than the screen width to be chopped (truncated) rather than wrapped. That is, the portion of a long line that does not fit in the screen width is not shown. The default is to wrap long lines; that is, display the remainder on the
next line.
-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.
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1389 次 |
| 最近记录: |