iTerm2+oh-my-zsh搭个Mac电脑上好用好看终端
根据苹果网站上介绍,bash是 macOS Mojave 及更早版本中的默认Shell,从 macOS Catalina 开始,zsh(Z shell) 是所有新建用户帐户的默认Shell。
1. 安装Oh my zsh
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
2. 安装Powerline字体
pip3 install powerline-status --user
3. 安装nerd字体库
# git clone
git clone https://github.com/ryanoasis/nerd-fonts.git
# cd to folder
cd nerd-fonts
# run install shell
./install.sh
4. 安装主题
git clone https://github.com/fcamblor/oh-my-zsh-agnoster-fcamblor.git
cd oh-my-zsh-agnoster-fcamblor/
./install
打开.zshrc配置文件,将ZSH_THEME后面的字段改为agnoster,如果不想显示计算机名,可以再添加一句,如下:
ZSH_THEME="agnoster"
DEFAULT_USER="$USER"
5. 安装高亮插件、自动补全插件
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git
git clone https://github.com/zsh-users/zsh-autosuggestions
还是在.zshrc中配置,在文件添加下面一句:
source ~/.oh-my-zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
在plugins中添加高亮插件,如下:
plugins=(
git
zsh-syntax-highlighting
zsh-autosuggestions
)
最终效果: