about summary refs log tree commit diff
path: root/.config
diff options
context:
space:
mode:
authorStarfall <us@starfall.systems>2021-02-02 14:56:43 -0600
committerStarfall <us@starfall.systems>2021-02-08 15:14:00 -0600
commit205ffe0cf4c7b839d9bd09454244a3be5eddc082 (patch)
treedcc60c0bf8462fb917bfad3c38df7339fa0f70f5 /.config
parent82f43b640528e92f90053badd911ab7d2b8a4e91 (diff)
zsh: use vcs_info for branch name in prompt
Diffstat (limited to '.config')
-rw-r--r--.config/zsh/.zshrc10
1 files changed, 8 insertions, 2 deletions
diff --git a/.config/zsh/.zshrc b/.config/zsh/.zshrc
index edab06a..8822bfc 100644
--- a/.config/zsh/.zshrc
+++ b/.config/zsh/.zshrc
@@ -95,16 +95,22 @@ function spacetotab () {
 
 # prompt
 # TODO maybe just use someone else's theme altogether
-# TODO git integration was useful - port something from belak/zsh-utils or ohmyzsh
 # TODO location should control its length a little better
 # TODO only color the last segment of the path (pwd)
+setopt prompt_subst
+autoload -Uz vcs_info
+zstyle ':vcs_info:*' actionformats '%F{5}[%F{2}%b%F{3}|%F{1}%a%F{5}]%f '
+zstyle ':vcs_info:*' formats '%F{5}[%F{2}%b%F{5}]%f '
+zstyle ':vcs_info:(sv[nk]|bzr):*' branchformat '%b%F{1}:%F{3}%r'
+precmd () { vcs_info }
+
 user="%n"
 if [[ -n "$SSH_CLIENT" || "$USER" == "root" ]]; then
 	user+="@%M"
 fi
 last_status="%(?.%F{green}%#.%F{red}%?)%f"
 location="%F{blue}%3~%f"
-PROMPT="[$user:$location] $last_status "
+PROMPT="[$user:$location] "'${vcs_info_msg_0_}'"${last_status} "
 unset user
 unset last_status
 unset location