summaryrefslogtreecommitdiff
path: root/dot_local/share/toasty/prompts/prompt_toasty_setup
diff options
context:
space:
mode:
authorChloe Kudryavtsev <toast@toast.cafe>2020-02-14 19:11:04 -0500
committerChloe Kudryavtsev <toast@toast.cafe>2020-02-14 19:11:04 -0500
commit0d9a5a245a7be7e444d7f34e959dd06cb7b053e0 (patch)
tree3d42142e6ee22dbb72683e0b3549216f17bb6629 /dot_local/share/toasty/prompts/prompt_toasty_setup
parentzsh: remove toasty (preparation for git subtree) (diff)
parentSquashed 'dot_local/share/toasty/' content from commit aee4da7 (diff)
Merge commit '858a4a31a251d0eab21dffb96776aca007dafb07' as 'dot_local/share/toasty'
Diffstat (limited to 'dot_local/share/toasty/prompts/prompt_toasty_setup')
-rw-r--r--dot_local/share/toasty/prompts/prompt_toasty_setup32
1 files changed, 32 insertions, 0 deletions
diff --git a/dot_local/share/toasty/prompts/prompt_toasty_setup b/dot_local/share/toasty/prompts/prompt_toasty_setup
new file mode 100644
index 0000000..c10c766
--- /dev/null
+++ b/dot_local/share/toasty/prompts/prompt_toasty_setup
@@ -0,0 +1,32 @@
+setopt promptsubst
+
+autoload -Uz add-zsh-hook
+autoload -Uz vcs_info
+
+zstyle ':vcs_info:*' enable git
+zstyle ':vcs_info:*' check-for-changes false
+zstyle ':vcs_info:*' actionformats \
+ '%B%F{cyan}(%b)%f%%b%c'
+zstyle ':vcs_info:*' formats \
+ '%B%F{cyan}(%b)%f%%b%c'
+
+# we want to catch unstaged and untracked in one swoop
+zstyle ':vcs_info:git*+set-message:*' hooks git-dirty
+function +vi-git-dirty {
+ if [[ $(git rev-parse --is-inside-work-tree 2> /dev/null) == 'true' ]]
+ then
+ if git status --porcelain | grep -Fq -e 'A' -e '??' -e 'M'
+ then
+ hook_com[staged]+=' %B%F{yellow}✗%f%b '
+ else
+ hook_com[staged]+=' %B%F{green}✔%f%b '
+ fi
+ fi
+}
+
+add-zsh-hook -Uz precmd vcs_info
+
+PS1='%B%(?.%F{green}.%F{red})→%f%b %B%(!.%F{red}.%F{blue})%1~%f%b ${vcs_info_msg_0_}'
+RPS1='%B%F{red}[%n@%m]%f%b'
+
+# vim: ft=zsh