32 lines
989 B
Bash
32 lines
989 B
Bash
#!/bin/env zsh
|
|
autoload -Uz vcs_info
|
|
precmd_vcs_info() { vcs_info }
|
|
precmd_functions+=( precmd_vcs_info )
|
|
setopt prompt_subst
|
|
zstyle ':vcs_info:*' stagedstr 'M'
|
|
zstyle ':vcs_info:*' unstagedstr '!'
|
|
zstyle ':vcs_info:*' check-for-changes true
|
|
zstyle ':vcs_info:git:*' formats '%F{5} %b %F{1}%c%u %f'
|
|
zstyle ':vcs_info:git*+set-message:*' hooks git-untracked
|
|
zstyle ':vcs_info:*' enable git
|
|
+vi-git-untracked() {
|
|
|
|
# git status ahead
|
|
if [[ $(git status --porcelain -b | grep '^## [^ ]\+ .*ahead') ]]; then
|
|
hook_com[unstaged]+='%F{1}⇡%f'
|
|
fi
|
|
|
|
# git untracked
|
|
if [ $(git rev-parse --is-inside-work-tree 2> /dev/null) = 'true' ] && \
|
|
[ $(git ls-files --other --directory --exclude-standard | sed q | wc -l | tr -d ' ') = 1 ] ; then
|
|
hook_com[unstaged]+='%F{1}?%f'
|
|
fi
|
|
}
|
|
|
|
precmd () { vcs_info }
|
|
#RPROMPT=\$vcs_info_msg_0_
|
|
PS1="
|
|
%B%F{blue}%~ \$vcs_info_msg_0_
|
|
%F{green}$>%f%b "
|
|
ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE="fg=#60C0FF,bold,underline"
|
|
ZSH_AUTOSUGGEST_HISTORY_IGNORE="ls *,cd *"
|