mac修改终端文件夹颜色

mac修改终端文件夹颜色

MacOS10.15以后,终端换用zsh的方法如下:

上述介绍都是针对终端软件是Bash的情况,苹果从MacOS10.15开始终端的默认软件已经更换为zsh了。上述功能实现需要在zsh的配置文件中实现。

img

vim .zshrc

export CLICOLOR=1
export LSCOLORS=ExGxFxdaCxDaDahbadeche

autoload -U colors && colors
PROMPT="%{$fg_bold[cyan]%}%n%{$reset_color%}@%{$fg_bold[cyan]%}%m %{$fg_bold[green]%}%1~ %{$reset_color%}%#"

:x

img

评论区有朋友留言,换用zsh后,怎么让用户名和主机名有颜色呢。使用如下命令即可

PROMPT="%{$fg_bold[cyan]%}%n%{$reset_color%}@%{$fg_bold[cyan]%}%m %{$fg_bold[green]%}%1~ %{$reset_color%}%#"

$fg的意思为颜色浅一些。$fg_bold意思为颜色深一些。[ ]里的就是颜色。。具体解释如下

颜色解释为:

黑black or0 红red or1 绿green or2 ⻩yellow or3 蓝blue or4 紫magenta or5 ⻘cyan or6 白white or7
posted @ 2023-02-14 23:31  zong涵  阅读(233)  评论(0编辑  收藏  举报