#!/usr/bin/env zsh # shellcheck disable=SC2155 # Configuration variables: # Once we are too deep in the filestructure, we can usually afford to shorten # the whole working directory and only print something like ~/.../dir3/dir4/dir5 # instead of ~/dir1/dir2/dir3/dir4/dir5. If this isn't desired, set this to 0 USE_SHORTENED_WORKDIR=1 # Show how much time it took to run a command CMD_TIME_SHOW=1 # Minimum units to show the time precision, if # we use "s" (seconds), and the output took 0s, # we don't print the output at all to avoid clutter. # Same goes for any other units, however with "ms" # (miliseconds), this is very unlikely # Valid options: ms/s/m/h/d CMD_TIME_PRECISION="s" # Minimum time in miliseconds, to print the time took, # if the command takes less than this amount of miliseconds, # don't bother printing the time took, this is nice if you # don't need to see how long commands like 'echo' took # Setting this to 0 will always print the time taken CMD_TIME_MINIMUM=100 # hide EOL sign ('%') export PROMPT_EOL_MARK="" # TTY (pure linux) terminal only has 8-bit color support # (unless you change it in kernel), respect this and downgrade # the color scheme accordingly (it won't look best, but it's # still better than no colors) if [ "$TERM" = "linux" ]; then GREEN="%F{002}" RED="%F{001}" ORANGE="%F{003}" BLUE="%F{004}" LBLUE="%F{006}" PURPLE="%F{005}" else GREEN="%F{047}" RED="%F{196}" ORANGE="%F{214}" BLUE="%F{027}" LBLUE="%F{075}" PURPLE="%F{105}" fi RESET="%f" # Signals git status of CWD repository (if any) git_prompt() { ref=$(command git symbolic-ref HEAD 2> /dev/null) || ref=$(command git rev-parse --short HEAD 2> /dev/null) || return 0 echo -n " $ORANGE${ref#refs/heads/}" if [ -n "$(git status --short 2>/dev/null)" ]; then echo "$RED+" fi } # Adds @chroot or @ssh foreign_prompt() { if [ "$(awk '$5=="/" {print $1}'