shfmt agnoster theme

pull/1697/head
Noah Gorny 2020-10-31 22:09:11 +02:00 committed by Noah Gorny
parent ae9da3b62b
commit 60da498ed4
1 changed files with 196 additions and 198 deletions

View File

@ -71,7 +71,7 @@ PROMPT_DIRTRIM=2 # bash4 and above
DEBUG=0 DEBUG=0
debug() { debug() {
if [[ ${DEBUG} -ne 0 ]]; then if [[ ${DEBUG} -ne 0 ]]; then
>&2 echo -e $* echo >&2 -e $*
fi fi
} }
@ -122,7 +122,7 @@ bg_color() {
cyan) echo 46 ;; cyan) echo 46 ;;
white) echo 47 ;; white) echo 47 ;;
orange) echo 48\;5\;166 ;; orange) echo 48\;5\;166 ;;
esac; esac
} }
# TIL: declare is global not local, so best use a different name # TIL: declare is global not local, so best use a different name
@ -210,18 +210,17 @@ prompt_virtualenv() {
if [[ -n $VIRTUAL_ENV ]]; then if [[ -n $VIRTUAL_ENV ]]; then
color=cyan color=cyan
prompt_segment $color $PRIMARY_FG prompt_segment $color $PRIMARY_FG
ve=`basename "$VIRTUAL_ENV"` ve=$(basename "$VIRTUAL_ENV")
prompt_segment $color white "$ve" prompt_segment $color white "$ve"
fi fi
} }
### Prompt components ### Prompt components
# Each component will draw itself, and hide itself if no information needs to be shown # Each component will draw itself, and hide itself if no information needs to be shown
# Context: user@hostname (who am I and where am I) # Context: user@hostname (who am I and where am I)
prompt_context() { prompt_context() {
local user=`whoami` local user=$(whoami)
if [[ $user != $DEFAULT_USER || -n $SSH_CLIENT ]]; then if [[ $user != $DEFAULT_USER || -n $SSH_CLIENT ]]; then
prompt_segment black default "$user@\h" prompt_segment black default "$user@\h"
@ -234,7 +233,6 @@ prompt_histdt() {
prompt_segment black default "\! [\A]" prompt_segment black default "\! [\A]"
} }
git_status_dirty() { git_status_dirty() {
dirty=$(git status -s 2> /dev/null | tail -n 1) dirty=$(git status -s 2> /dev/null | tail -n 1)
[[ -n $dirty ]] && echo " ●" [[ -n $dirty ]] && echo " ●"