From 8e4d61fb77ed68f896b6fe3dc0bbbcd078668ede Mon Sep 17 00:00:00 2001 From: Ben Burwell Date: Tue, 13 Aug 2019 23:33:32 -0400 Subject: zsh: adopt --- templates/.zsh/prompt.zsh | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 templates/.zsh/prompt.zsh (limited to 'templates/.zsh/prompt.zsh') 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) ' -- cgit v1.2.3