aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBlake Romero <blake@blkrom.com>2024-11-01 00:30:30 +0000
committerBlake Romero <blake@blkrom.com>2024-11-01 00:42:40 +0000
commitc891a9f8ea856ef2694656c51e35ca63c1f002f2 (patch)
treeda04a972007e1372574f6e8895413e42d269ca00
parent1758d2642d2505d4868b6895d7663833a24ee2ed (diff)
Add custom bash prompt
-rw-r--r--dot-bashrc15
1 files changed, 15 insertions, 0 deletions
diff --git a/dot-bashrc b/dot-bashrc
index 6a213c7..ec7af07 100644
--- a/dot-bashrc
+++ b/dot-bashrc
@@ -28,3 +28,18 @@ shopt -s histappend
# Immediately add history instead of end of session
export PROMPT_COMMAND="history -a; history -c; history -r; $PROMPT_COMMAND"
+# Prompt
+red="$(tput setaf 9)"
+green="$(tput setaf 10)"
+blue="$(tput setaf 12)"
+yellow="$(tput setaf 11)"
+reset="$(tput sgr0)"
+
+host="\[$red\]\h\[$reset\]"
+user="\[$blue\]\u\[$reset\]"
+dir="\[$yellow\]\w\[$reset\]"
+function branch() {
+ branch="$(git branch 2>/dev/null | sed -n -E 's/^\* (.*)/\1/p')"
+ [ -n "$branch" ] && printf " on \001%s\002%s\001%s\002" "$green" "$branch" "$reset"
+}
+export PS1="[$user@$host in $dir\$(branch)] "