xonecas.io
2780
D2

dotfiles-2014 / commit 52015da

New prompt format

Sean2016-04-19 52015daea43aacacb13d77cf8ad176d05219dfdc parent 6d83241

1 file changed

bashrc+15−4
@@ -146,14 +146,14 @@ function __git_branch {
146146
147147 function __virtualenv {
148148 local env=$(basename "$VIRTUAL_ENV")
149- [ "$env" != "" ] && echo "py:$env"
149+ [ "$env" != "" ] && echo "$env"
150150 }
151151
152152 function __node {
153153 if hash node 2>/dev/null; then
154154 local v=$(node -v)
155155 fi
156- [ "$v" != "" ] && echo "n:${v:1}"
156+ [ "$v" != "" ] && echo "${v:1}"
157157 }
158158
159159 function __info {
@@ -164,8 +164,13 @@ function __info {
164164 full="${full[*]}"
165165 [ "$full" != "" ] && echo "$full"
166166 }
167+
167168 function __gitinfo {
168- full="$(__git_branch)$(__git_dirty)"
169+ local full=(
170+ $(__git_branch)
171+ $(__git_dirty)
172+ )
173+ full="${full[*]}"
169174 [ "$full" != "" ] && echo "$full"
170175 }
171176
@@ -174,4 +179,10 @@ COLOR2=$(tput setaf 2)
174179 COLOR3=$(tput setaf 3)
175180 CLEAR=$(tput sgr0)
176181
177-PS1="\[\$COLOR1\]on \[$COLOR2\]$(hostname) \[\$COLOR1\]at \[$COLOR2\]\w \[\$COLOR1\]in \[$COLOR2\]$(__gitinfo) \[\$COLOR1\]using \[$COLOR2\]$(__info) \[$COLOR3\]✭ \[\$CLEAR\]"
182+HN="\[\$COLOR1\]h:\[\$COLOR2\]$(hostname)"
183+DIR="\[\$COLOR1\]d:\[\$COLOR2\]\w"
184+GI="\[\$COLOR1\]g:\[\$COLOR2\]$(__gitinfo)"
185+N="\[\$COLOR1\]n:\[\$COLOR2\]$(__node)"
186+PY="\[\$COLOR1\]py:\[\$COLOR2\]$(__virtualenv)"
187+
188+PS1="$HN $DIR $GI $N $PY \[\$COLOR3\]✭ \[\$CLEAR\]"