From fb5d86e3e2c4b93526d6a987e15feee453658474 Mon Sep 17 00:00:00 2001 From: Loic Nageleisen Date: Fri, 13 Dec 2013 16:38:45 +0100 Subject: [PATCH] WIP: zsh vcs status --- zsh/prompt | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/zsh/prompt b/zsh/prompt index 8d6a535..07c30da 100644 --- a/zsh/prompt +++ b/zsh/prompt @@ -169,6 +169,32 @@ prompt_vcs_repo() { } +prompt_vcs_status() { + # status symbols + if prompt_git; then + local vcs_status="" + [[ "$GIT_PS1_STATUS" == *h* ]] && vcs_status+="${NONE}↰" + [[ "$GIT_PS1_STATUS" == *t* ]] && vcs_status+="${R}!" + [[ "$GIT_PS1_STATUS" == *u* ]] && vcs_status+="${Y}≠" + [[ "$GIT_PS1_STATUS" == *s* ]] && vcs_status+="${R}±" + [[ "$GIT_PS1_STATUS" == *n* ]] && vcs_status+="${BB}∅" + [[ -n "$vcs_status" ]] && prompt_segment white black "${vcs_status}" + fi +} + +prompt_vcs_action() { + # action info + if prompt_git; then + local action="" + [[ "$GIT_PS1_STATUS" == *R* ]] && action+=" rebase" + [[ "$GIT_PS1_STATUS" == *i* ]] && action+="-i" + [[ "$GIT_PS1_STATUS" == *A* ]] && action+=" apply" + [[ "$GIT_PS1_STATUS" == *M* ]] && action+=" merge" + [[ "$GIT_PS1_STATUS" == *B* ]] && action+=" bisect" + [[ -n "$action" ]] && prompt_segment yellow white "$action" + fi +} + prompt_segment_test() { prompt_segment red white prompt_segment default white @@ -259,6 +285,8 @@ rprompt_build() { prompt_setup_segments CURRENT_BG='NONE' prompt_last_rc + #prompt_vcs_status + #prompt_vcs_action rprompt_end }