macOS 美化终端、命令提示、安装字体

1,159 阅读1分钟

一、设置代理

查看详细代理教程:macOS Linux 终端设置http https SOCKS代理

二、安装homebrew

点我进官网教程

1、Install Homebrew (on macOS or Linux)

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

2、Uninstall Homebrew

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh)"

如果出现问题

export PATH=/opt/homebrew/bin:$PATH

三、安装oh my zsh

点我进官网教程

sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

四、安装字体

点我进官网教程(nerd-fonts)推荐

brew tap homebrew/cask-fonts
brew install --cask font-hack-nerd-font

配置终端

在这里插入图片描述

请添加图片描述

点我进官网教程(powerline/font)

clone

git clone https://github.com/powerline/fonts.git --depth=1

install

cd fonts
./install.sh

clean-up a bit

cd ..
rm -rf fonts

五、安装powerlevel10k

点我进官网教程

git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k

六、安装插件

点我进官网教程

安装以下几个插件并添加到.zshrc文件中的plugins中后,在命令行中执行命令时,会有语法高亮,历史命令提示,和路径补全等

zsh-syntax-highlighting:语法高亮,命令正确执行时是绿色的,失败时是红色的

git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting

zsh-autosuggestions:输入命令时,会提供命令补全,路径补全等,按键盘 → 补全

git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions

zsh-history-substring-search:这个是记住执行过的命令的,使用上下键可以方便的再次执行指定的命令

git clone https://github.com/zsh-users/zsh-history-substring-search ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-history-substring-search

安装完插件后,编辑.zshrc文件,把插件都添加到文件中去:

# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc.
。。。。
。省略 。
。。。。
# Add wisely, as too many plugins slow down shell startup.
plugins=(git
	 zsh-syntax-highlighting
	 zsh-autosuggestions
	 zsh-history-substring-search)

source $ZSH/oh-my-zsh.sh
。。。。
。省略 。
。。。。
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh

七、安装exa

点我进官网教程

brew install exa
sudo vim ./.zshrc

alias l='exa -l'

alias ls='exa'

alias la='exa -la'

八、美化

在这里插入图片描述 在这里插入图片描述 在这里插入图片描述