MAC终端配置

用了7年MBP终于要准备退休了,新电脑到手重新配置一下开发环境,稍微做个记录。

git显示分支 & 大小写补全

zsh 终端设置

1
vi ~/.zshrc

写入以下语句

1
2
3
4
5
6
7
8
9
10
11
# git显示分支
function parse_git_branch() {
git branch 2> /dev/null | sed -n -e 's/^\* \(.*\)/[\1]/p'
}

setopt PROMPT_SUBST
export PROMPT='%F{grey}%n%f %F{cyan}%~%f %F{green}$(parse_git_branch)%f %F{normal}$%f '

# 大小写补全
autoload -Uz compinit && compinit
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}'

重启终端或通过 source 命令生效

1
source ~/.zshrc

附录资料
MacOS 上 oh-my-zsh 安装与卸载
终端显示出git分支
大小写补全


MAC终端配置
https://guoningyan.com/2022/09/15/MAC终端配置/
作者
Ningyan Guo
发布于
2022年9月15日
许可协议