dotfiles

custom dotfiles
git clone git://git.pyratebeard.net/dotfiles.git
Log | Files | Refs | README

commit 923cf86fd45a334eee9b862004e207d06cf9e287
parent 5d8bd4c0732db697666f5fbb44e3ad4c6362907b
Author: dudley <root@pyratebeard.net>
Date:   Fri, 14 Jul 2017 20:42:15 +0100

added git prompt info into minimal prompt. made default

Diffstat:
Azsh/.zsh/minimal-git-prompt.zsh | 56++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mzsh/.zsh/prompt.zsh | 44+++++++++++++++++++++++++++++++++++++++++++-
2 files changed, 99 insertions(+), 1 deletion(-)

diff --git a/zsh/.zsh/minimal-git-prompt.zsh b/zsh/.zsh/minimal-git-prompt.zsh @@ -0,0 +1,56 @@ +# '########::'######::'##::::'##: +# ..... ##::'##... ##: ##:::: ##: +# :::: ##::: ##:::..:: ##:::: ##: +# ::: ##::::. ######:: #########: +# :: ##::::::..... ##: ##.... ##: +# : ##::::::'##::: ##: ##:::: ##: +# ########:. ######:: ##:::: ##: +# ........:::......:::..:::::..:: +# +# AUTHOR pyratebeard <root@pyratebeard.net> +# CODE http://github.com/pyratebeard/dotfiles +# +setopt PROMPT_SUBST +#???? colors for permissions +if [[ "$EUID" -ne "0" ]] +then # if user is not root + USER_LEVEL="${COLOR_USER}" +else # root! + USER_LEVEL="${COLOR_ROOT}" +fi + +GIT_PROMPT() { + test=$(git rev-parse --is-inside-work-tree 2> /dev/null) + if [ ! "$test" ] + then + case "$PROMPT_STYLE" in + ascii) + echo "$reset_color%F{cyan}??" + ;; + arrows) + echo "$reset_color%F{cyan}?" + ;; + esac + return + fi + ref=$(git name-rev --name-only HEAD | sed 's!remotes/!!' 2> /dev/null) + dirty="" && [[ $(git diff --shortstat 2> /dev/null | tail -n1) != "" ]] && dirty=$ICO_DIRTY + stat=$(git status | sed -n 2p) + case "$stat" in + *ahead*) + stat=$ICO_AHEAD + ;; + *behind*) + stat=$ICO_BEHIND + ;; + *diverged*) + stat=$ICO_DIVERGED + ;; + *) + stat="" + ;; + esac + echo "${USER_LEVEL}[${COLOR_NORMAL}"${ref}${dirty}${stat}"${USER_LEVEL}] " +} +# Minimal prompt +PROMPT='%F{cyan}${USERNAME}@%F{white}[archee] $(GIT_PROMPT): %~# ' diff --git a/zsh/.zsh/prompt.zsh b/zsh/.zsh/prompt.zsh @@ -10,5 +10,47 @@ # AUTHOR pyratebeard <root@pyratebeard.net> # CODE http://github.com/pyratebeard/dotfiles # +setopt PROMPT_SUBST +#???? colors for permissions +if [[ "$EUID" -ne "0" ]] +then # if user is not root + USER_LEVEL="${COLOR_USER}" +else # root! + USER_LEVEL="${COLOR_ROOT}" +fi + +GIT_PROMPT() { + test=$(git rev-parse --is-inside-work-tree 2> /dev/null) + if [ ! "$test" ] + then + case "$PROMPT_STYLE" in + ascii) + echo "$reset_color%F{cyan}??" + ;; + arrows) + echo "$reset_color%F{cyan}?" + ;; + esac + return + fi + ref=$(git name-rev --name-only HEAD | sed 's!remotes/!!' 2> /dev/null) + dirty="" && [[ $(git diff --shortstat 2> /dev/null | tail -n1) != "" ]] && dirty=$ICO_DIRTY + stat=$(git status | sed -n 2p) + case "$stat" in + *ahead*) + stat=$ICO_AHEAD + ;; + *behind*) + stat=$ICO_BEHIND + ;; + *diverged*) + stat=$ICO_DIVERGED + ;; + *) + stat="" + ;; + esac + echo "${USER_LEVEL}[${COLOR_NORMAL}"${ref}${dirty}${stat}"${USER_LEVEL}] " +} # Minimal prompt -PROMPT='%F{cyan}${USERNAME}@%F{white}[archee] : %~# ' +PROMPT='%F{cyan}${USERNAME}@%F{white}[archee] $(GIT_PROMPT): %~# '