aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakob Odersky <jakob@odersky.com>2019-05-05 13:27:00 -0400
committerJakob Odersky <jakob@odersky.com>2019-05-05 13:27:00 -0400
commit2a0439db520460247041d84587d93915a773d799 (patch)
tree01895e4b1a6aa5de4cf7395a53eb04bf8d63ae2e
parentab59fac859678eacd26b06fc198e0cd379dd3000 (diff)
downloaddotfiles-2a0439db520460247041d84587d93915a773d799.tar.gz
dotfiles-2a0439db520460247041d84587d93915a773d799.tar.bz2
dotfiles-2a0439db520460247041d84587d93915a773d799.zip
Cleanup prompt
-rw-r--r--home/.bashrc.d/prompt.sh45
1 files changed, 17 insertions, 28 deletions
diff --git a/home/.bashrc.d/prompt.sh b/home/.bashrc.d/prompt.sh
index 0875ef5..59e587f 100644
--- a/home/.bashrc.d/prompt.sh
+++ b/home/.bashrc.d/prompt.sh
@@ -2,48 +2,37 @@ function __prompt_command() {
local exit="$?"
PS1=""
# set title for terminal emulators
- PS1+="\\[\\e]0;${debian_chroot:+($debian_chroot)}\\u@\\h: \\w\\a\\]"
+ PS1+="\\[\\e]0;\\u@\\h: \\w\\a\\]"
local red='\[\e[31m\]'
local green='\[\e[32m\]'
- local light_green='\[\e[92m\]'
+ local yellow='\[\e[33m\]'
local light_blue='\[\e[94m\]'
local reset='\[\e[0m\]'
PS1+="ā•­"
- if [ "$exit" -eq 0 ]; then
- PS1+="${green}(āœ”)${reset} "
- else
- PS1+="${red}(āœ—)${reset} "
- fi
-
-# if [[ $(command -v kubectl) ]]; then
-# PS1+="[$(kubectl config current-context)] "
-# fi
-
- PS1+="${debian_chroot:+($debian_chroot)}${light_green}\\u@\\h${reset}:${light_blue}\\W${reset}"
+ PS1+="${light_blue}\\w${reset}"
- ### Add Git Status ###
+ ### Add Git Status
## Inspired by http://www.terminally-incoherent.com/blog/2013/01/14/whats-in-your-bash-prompt/
if [[ $(command -v git) ]]; then
- local git_status
- if git_status="$(git status --porcelain 2>/dev/null)"; then
- if [[ -z $git_status ]]; then
- git_color="${green}"
- else
- git_color="${red}"
- fi
- local git_branch
- git_branch="$(git status --porcelain --branch 2>/dev/null \
- | grep '^##' \
- | cut -c4-)"
- PS1+=" ${git_color}[${git_branch}]${reset}"
- fi
+ local git_status
+ if git_status="$(git status --porcelain=2 2>/dev/null)"; then
+ if [[ -z $git_status ]]; then
+ git_color="${green}"
+ else
+ git_color="${yellow}"
+ fi
+ local git_branch
+ git_branch="$(git status --porcelain=2 --branch 2>/dev/null \
+ | sed --quiet 's/# branch.head //p' - )"
+ PS1+=" ${git_color}[${git_branch}]${reset}"
+ fi
fi
if [ "$exit" -ne 0 ]; then
- PS1+=" ${red}(exit $exit)${reset}"
+ PS1+=" ${red}(exit $exit)${reset}"
fi
PS1+="\\nā•°\$ ${reset}"