diff options
-rw-r--r-- | zsh/.zshrc | 24 |
1 files changed, 22 insertions, 2 deletions
@@ -37,8 +37,28 @@ alias newsboat="newsboat -u ~/.config/newsboat/urls" # Changing Default Prompt # PS1='[%F{#ff0000}%n%f %F{#6a0dad}%1d%f] ' -PS1='[%F{#1111ee}%1d%f] => ' -PROMPT=$PS1 +# PS1='[%F{#1111ee}%1d%f] => ' +# Creates a git prompt +git_branch_test_color() { + local ref=$(git symbolic-ref --short HEAD 2> /dev/null) + if [ -n "${ref}" ]; then + if [ -n "$(git status --porcelain)" ]; then + local gitstatuscolor='%F{red}' + else + local gitstatuscolor='%F{green}' + fi + echo "${gitstatuscolor} (${ref})" + else + echo "" + fi +} +setopt PROMPT_SUBST +# PS1="%? | [%F{#ff0000}%n%f] [$(vcs_info_wrapper)] %2~ %# " +PROMPT='%9c$(git_branch_test_color)%F{none} %# ' +RPROMPT='%D{%k:%M:%S}' + + +# PROMPT=$PS1 ########## Aliases / Functions ########## # allow sudo to make use of aliases |