aboutsummaryrefslogtreecommitdiff
path: root/templates/.zsh/prompt.zsh
diff options
context:
space:
mode:
authorBen Burwell <ben@benburwell.com>2019-08-13 23:33:32 -0400
committerBen Burwell <ben@benburwell.com>2019-08-13 23:33:32 -0400
commit8e4d61fb77ed68f896b6fe3dc0bbbcd078668ede (patch)
treed521e523316d239caea0bf4a35ce851236dad53e /templates/.zsh/prompt.zsh
parent7d4c541a0d4f09eb421425f8d49b65308d9e6cfd (diff)
zsh: adopt
Diffstat (limited to 'templates/.zsh/prompt.zsh')
-rw-r--r--templates/.zsh/prompt.zsh23
1 files changed, 23 insertions, 0 deletions
diff --git a/templates/.zsh/prompt.zsh b/templates/.zsh/prompt.zsh
new file mode 100644
index 0000000..f98a73e
--- /dev/null
+++ b/templates/.zsh/prompt.zsh
@@ -0,0 +1,23 @@
+autoload -Uz vcs_info
+setopt prompt_subst
+zstyle ':vcs_info:*' enable git
+zstyle ':vcs_info:*' check-for-changes true
+zstyle ':vcs_info:*' stagedstr '+'
+zstyle ':vcs_info:git:*' unstagedstr '*'
+zstyle ':vcs_info:git*' formats " %b%u%c"
+zstyle ':vcs_info:git*' actionformats " %b (%a)"
+
+git_prompt() {
+ local dirty
+ if $(git rev-parse --is-inside-work-tree >/dev/null 2>&1); then
+ dirty=$(git status --porcelain 2>/dev/null | wc -l)
+ vcs_info
+ if [[ "$dirty" -ne "0" ]]; then
+ echo -n "%F{yellow}${vcs_info_msg_0_}%f"
+ else
+ echo -n "%F{green}${vcs_info_msg_0_}%f"
+ fi
+ fi
+}
+
+export PROMPT='%F{blue}%~%f$(git_prompt) '