Created
August 14, 2024 14:00
-
-
Save Liametc/79a39588498d4bc7702e57d7278f573c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# User specific aliases and functions | |
__PROMPT_COMMAND() { | |
local allOFF='\[\e[0m\]' | |
local underline='\[\e[4m\]' | |
local underlineOFF='\[\e[24m\]' | |
local italic='\[\e[3m\]' | |
local italicOFF='\[\e[23m\]' | |
local black_bg='\[\e[40m\]' | |
local black_fg='\[\e[30m\]' | |
local red_bg='\[\e[41m\]' | |
local red_fg='\[\e[31m\]' | |
local green_bg='\[\e[42m\]' | |
local green_fg='\[\e[32m\]' | |
local yellow_bg='\[\e[43m\]' | |
local yellow_fg='\[\e[33m\]' | |
local blue_bg='\[\e[44m\]' | |
local blue_fg='\[\e[34m\]' | |
local pink_bg='\[\e[45m\]' | |
local pink_fg='\[\e[35m\]' | |
local cyan_bg='\[\e[46m\]' | |
local cyan_fg='\[\e[36m\]' | |
local foreground_bg='\[\e[47m\]' | |
local foreground_fg='\[\e[37m\]' | |
local PROMPT="$allOFF" | |
PROMPT+="$blue_bg" ####################### | |
PROMPT+="$black_fg" | |
PROMPT+='\u@\H ' # User at machine | |
PROMPT+="$yellow_fg" ####################### | |
PROMPT+="◥" | |
PROMPT+="$yellow_bg" ####################### | |
PROMPT+="$black_fg" ####################### | |
PROMPT+=' \w ' # PWD, Full path | |
# Git branch | |
local git_branch="$(git branch --color=never 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/߇ \1 /')" | |
if [ "$git_branch" != '' ]; then | |
PROMPT+="$cyan_fg" | |
PROMPT+="◥" | |
PROMPT+="$cyan_bg" | |
PROMPT+="$black_fg" | |
[[ "$(git status --short)" == '' ]] || PROMPT+="$italic$underline" | |
PROMPT+=" $git_branch" | |
[[ "$(git status --short)" == '' ]] || PROMPT+="$underlineOff$italicOff" | |
fi | |
if [[ "$VIRTUAL_ENV" != "" ]]; then | |
PROMPT+="$red_fg" | |
PROMPT+="◥" | |
PROMPT+="$red_bg" | |
PROMPT+="$black_fg" | |
PROMPT+=" [$(basename ${VIRTUAL_ENV})] " | |
fi | |
PROMPT+="$allOFF " # End colours | |
rez_prompt=${REZ_ENV_PROMPT:+[rez] $REZ_ENV_PROMPT} | |
PROMPT+='\n↳ ${rez_prompt:-\$} ' # Shell prompt | |
PS1="${PROMPT}" | |
} | |
[[ "$TERM" != "linux" ]] && PROMPT_COMMAND=__PROMPT_COMMAND |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment