1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
| alias ls='ls --color' # ls 命令显示颜色 alias ll='ls -al' alias code='open -a /Applications/Visual\ Studio\ Code.app' alias goland='open -a /Applications/GoLand.app' alias idea='open -a /Applications/IntelliJ\ IDEA.app' alias count_file='ls -l | grep "^-" | wc -l'
# 获取git分支名称 function parse_git_branch() { branch=`git branch 2> /dev/null | sed -n -e 's/^\* \(.*\)/\(\1\)/p'` if [[ $branch = "" ]]; then echo "" else echo " $branch" fi }
# 获取 git 仓库的提交状态 function parse_git_status() { sta=`git status -s 2> /dev/null | head -n 1` if [[ $sta = "" ]]; then echo "" else echo " ✗" fi }
# 设置提示符 # 格式:[日期] 所处文件夹名 (git分支名) $ <git 未提交状态> autoload -U colors && colors setopt PROMPT_SUBST export PROMPT='[%{$fg[red]%}%T%{$reset_color%}] %{$fg[blue]%}%1d%{$reset_color%}%F{yellow}$(parse_git_branch)%f%F{normal}$%f%{$fg[red]%}$(parse_git_status)%{$reset_color%} ' # PROMPT="[%{$fg[red]%}%T%{$reset_color%}] %{$fg[blue]%}%1d%{$reset_color%}$ "
# 开启自动补全 autoload -U compinit && compinit # 设置补全文件夹名称不区分大小写 zstyle ':completion:*' matcher-list 'm:{[:lower:][:upper:]}={[:upper:][:lower:]}' 'm:{[:lower:][:upper:]}={[:upper:][:lower:]} l:|=* r:|=*' 'm:{[:lower:][:upper:]}={[:upper:][:lower:]} l:|=* r:|=*' 'm:{[:lower:][:upper:]}={[:upper:][:lower:]} l:|=* r:|=*'
|