MAC configuration oh-my-zsh configuration terminal color

installation steps

1. 安装homebrew: Installation — Homebrew Documentation

# 如果不可用,使用上面的链接进入负责最新的安装命令
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"

# 如果报403错误,说明网络不通,可使用下面命令。
/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"

# 安装完成后会有提示,根据提示复制命令添加到系统路径
# ==> Next steps:
# - Run these two commands in your terminal to add Homebrew to your PATH:
#    echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ....
#    eval "$(/opt/homebrew/bin/brew shellenv)"

2. Install zsh

brew install zsh # 安装zsh
# sudo yum install -y  zsh # linux下安装命令
echo $SHELL # 正常情况下会显示如下内容,表示配置成功
# /bin/zsh
# 如果显示为/bin/bash,则通过下面命令进行修改
cat /etc/shells # 查看可用的sh
chsh -s /bin/zsh # 修改为zsh,然后手动重启终端即可。

3. Install oh-my-zsh

sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
# 如果第一条报403,则使用下面的命令
sh -c "$(curl -fsSL https://gitee.com/mirrors/oh-my-zsh/raw/master/tools/install.sh)"

4. Configure the theme

# 注意mac下和linux下sed的语法不同,这里是mac下的命令
sed -i "" 's/ZSH_THEME="robbyrussell"/ZSH_THEME="ys"/g' ~/.zshrc # 根据个人喜好自行选择,我这里选择的是ys主题

# sed -i 's/ZSH_THEME="robbyrussell"/ZSH_THEME="ys"/g' ~/.zshrc # for linux

5. Re-open the terminal and you are done.

Unable to install color scheme for oh-my-zsh

Open the .bashrc in the home directory, set the PS1 variable, and import it. My color scheme is as follows

# 添加如下代码到~/.bashrc文件的最后一行即可。

export PS1="\e[32;1m\]# \[\e[31;40m\]\u @ \[\e[34;40m\]\h \[\e[32;40m\]\w \[\e[37;40m\][\A]\n$\[\e[m\] "


# 添加后,source文件生效。
source ~/.bashrc

Guess you like

Origin blog.csdn.net/lpfangle/article/details/124793293
Recommended