dotfiles/.config/zsh/theme
ziro 34a791751c + PS2 now unique to prevent confusion
+ Added custom python prompt theme
2020-11-07 06:57:37 +07:00

41 lines
1.2 KiB
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
}
function zle-line-init zle-keymap-select {
PS1="
%B%F{blue}%~ \$vcs_info_msg_0_
%F{green}${${KEYMAP/vicmd/N }/(main|viins)/}$>%f%b "
PS2="%B%F{blue}?>%f%b "
# RPS1="${${KEYMAP/vicmd/-- NORMAL --}/(main|viins)/-- INSERT --}"
# RPS2=$RPS1
zle reset-prompt
}
zle -N zle-line-init
zle -N zle-keymap-select
precmd () { vcs_info }
#RPROMPT=\$vcs_info_msg_0_
ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE="fg=#60C0FF,bold,underline"
ZSH_AUTOSUGGEST_HISTORY_IGNORE="ls *,cd *"