Mac终端的设置
1、安装包管理工具Homebrew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
/bin/bash -c install.sh
git config --global http.proxy http://127.0.0.1:xxxx
git config --global https.proxy https://127.0.0.1:xxxx
2、切换默认的shell
echo $SHELL
cat /etc/shells
chsh -s /bin/zsh
3、安装oh-my-zsh
sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
wget https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | sh
git clone https://github.com/zsh-users/zsh-syntax-highlighting ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
vim ~/.zshrc
source ~/.zshrc
git clone https://github.com/powerline/fonts
./install.sh
4、安装更改终端主题
#在用户目录下下载主题
git clone https://github.com/mbadolato/iTerm2-Color-Schemes.git
#terminal文件夹下的主题文件是为 macOS 原生终端 Terminal 准备的主题。这其中以 .terminal 结尾的文件就是终端的主题配置文件。
5、隐藏zsh终端前面的用户名和主机名
prompt_context() {}
prompt_context() {
if [[ "$USER" != "$DEFAULT_USER" || -n "$SSH_CLIENT" ]]; then
prompt_segment black default "%(!.%{%F{yellow}%}.)$USER"
fi
}
prompt_context() {
if [[ "$USER" != "$DEFAULT_USER" || -n "$SSH_CLIENT" ]]; then
prompt_segment black default "%(!.%{%F{yellow}%}.)$HOST"
fi
}