在 Ubuntu 的 Zsh 中将颜色设置为 Less
如何在 Ubuntu 中获得与 Zsh 的 Less 和 Bash 的 Less 类似的突出显示?
我从 OS X 切换到 Ubuntu。 My Less 在 Zsh 中无法按预期工作。
我的 Less 中的手册是绿色和黑色的,有或没有以下代码。
# comment these out in Ubuntu
export LESS_TERMCAP_mb=$'\E[01;31m' # begin blinking
export LESS_TERMCAP_me=$'\E[0m' # end mode
export LESS_TERMCAP_se=$'\E[0m' # end standout-mode
export LESS_TERMCAP_so=$'\E[38;5;246m' # begin standout-mode - info box
export LESS_TERMCAP_ue=$'\E[0m' # end underline
export LESS_TERMCAP_us=$'\E[04;33;146m' # begin underline is now yellow
# | | |
# | |----------------- yellow
# |-------------------- underline
# to have the indication of cursor's location and line numbers, and R
export LESS="-mNR"
# |--------- only ASCII color
该代码使手册在 OS X 中可读,但不适用于 Zsh 中的 Ubuntu。
Ubuntu 在 Bash 的 Less 中有出色的亮点。 我的手册在 Bash 中显示了黄色、绿色和黑色,没有我的代码。 Zsh 和 Bash 在 /usr/bin/less
中使用相同的 Less。 这表明 Ubuntu 的 Bash 有一些点文件可以在某处配置它。
Bash 中 Ubuntu 的 Less 突出显示在哪里?
How can you get similar highlightings to Zsh's Less than Bash's Less in Ubuntu?
I switched from OS X to Ubuntu. My Less do not work as expected in Zsh.
Manuals in my Less are green and black with or without the following code.
# comment these out in Ubuntu
export LESS_TERMCAP_mb=
The code makes manuals readable in OS X, but it does not work for Ubuntu in Zsh.
Ubuntu has excellent highlightings in Bash's Less. My manuals have the colors yellow, green and black in Bash without my code. Both Zsh and Bash use the same Less at /usr/bin/less
. This suggests me that Ubuntu's Bash has some dot-files which configure it somewhere.
Where are highlightings for Ubuntu's Less in Bash?
\E[01;31m' # begin blinking
export LESS_TERMCAP_me=
The code makes manuals readable in OS X, but it does not work for Ubuntu in Zsh.
Ubuntu has excellent highlightings in Bash's Less. My manuals have the colors yellow, green and black in Bash without my code. Both Zsh and Bash use the same Less at /usr/bin/less
. This suggests me that Ubuntu's Bash has some dot-files which configure it somewhere.
Where are highlightings for Ubuntu's Less in Bash?
\E[0m' # end mode
export LESS_TERMCAP_se=
The code makes manuals readable in OS X, but it does not work for Ubuntu in Zsh.
Ubuntu has excellent highlightings in Bash's Less. My manuals have the colors yellow, green and black in Bash without my code. Both Zsh and Bash use the same Less at /usr/bin/less
. This suggests me that Ubuntu's Bash has some dot-files which configure it somewhere.
Where are highlightings for Ubuntu's Less in Bash?
\E[0m' # end standout-mode
export LESS_TERMCAP_so=
The code makes manuals readable in OS X, but it does not work for Ubuntu in Zsh.
Ubuntu has excellent highlightings in Bash's Less. My manuals have the colors yellow, green and black in Bash without my code. Both Zsh and Bash use the same Less at /usr/bin/less
. This suggests me that Ubuntu's Bash has some dot-files which configure it somewhere.
Where are highlightings for Ubuntu's Less in Bash?
\E[38;5;246m' # begin standout-mode - info box
export LESS_TERMCAP_ue=
The code makes manuals readable in OS X, but it does not work for Ubuntu in Zsh.
Ubuntu has excellent highlightings in Bash's Less. My manuals have the colors yellow, green and black in Bash without my code. Both Zsh and Bash use the same Less at /usr/bin/less
. This suggests me that Ubuntu's Bash has some dot-files which configure it somewhere.
Where are highlightings for Ubuntu's Less in Bash?
\E[0m' # end underline
export LESS_TERMCAP_us=
The code makes manuals readable in OS X, but it does not work for Ubuntu in Zsh.
Ubuntu has excellent highlightings in Bash's Less. My manuals have the colors yellow, green and black in Bash without my code. Both Zsh and Bash use the same Less at /usr/bin/less
. This suggests me that Ubuntu's Bash has some dot-files which configure it somewhere.
Where are highlightings for Ubuntu's Less in Bash?
\E[04;33;146m' # begin underline is now yellow
# | | |
# | |----------------- yellow
# |-------------------- underline
# to have the indication of cursor's location and line numbers, and R
export LESS="-mNR"
# |--------- only ASCII color
The code makes manuals readable in OS X, but it does not work for Ubuntu in Zsh.
Ubuntu has excellent highlightings in Bash's Less. My manuals have the colors yellow, green and black in Bash without my code. Both Zsh and Bash use the same Less at /usr/bin/less
. This suggests me that Ubuntu's Bash has some dot-files which configure it somewhere.
Where are highlightings for Ubuntu's Less in Bash?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我的默认 shell 是 bash,所以对此持保留态度。 从
/etc/profile
开始,看看它如何获取特定于 bash 的文件。 您需要为zsh
重新创建该逻辑。 也许 zsh-lovers 包可以提供帮助,至少它的标题是 zsh 的提示、技巧和示例具有暗示性。
My default shell is
bash
so take this with a grain of salt. Start with/etc/profile
and see how it sources bash-specific files. You need to re-create that logic forzsh
. Maybe thezsh-lovers
package can help, at least its title of tips, tricks and examples for the zshis suggestive.
这对我在 archlinux 上的 zsh 有效:
mostlike.txt是这样
然后只需在您最喜欢的 shell 的 rc 文件中定义一个别名:
This works for me in zsh on archlinux:
mostlike.txt is this
And then just define an alias in the rc file of your favorite shell: