Last active
November 25, 2024 07:13
-
-
Save vaspoz/ce8130586220192583331056a2eb8cff to your computer and use it in GitHub Desktop.
Christmas prompt
This file contains hidden or 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
# print the git branch name if in a git project | |
parse_git_branch() { | |
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/' | |
} | |
# set the input prompt symbol | |
ARROW="β―" | |
# define text formatting | |
PROMPT_BOLD="$(tput bold)" | |
PROMPT_UNDERLINE="$(tput smul)" | |
PROMPT_FG_GREEN="$(tput setaf 2)" | |
PROMPT_FG_CYAN="$(tput setaf 6)" | |
PROMPT_FG_YELLOW="$(tput setaf 3)" | |
PROMPT_FG_MAGENTA="$(tput setaf 5)" | |
PROMPT_RESET="$(tput sgr0)" | |
# save each section prompt section in variable | |
PROMPT_SECTION_SHELL="\[$PROMPT_BOLD$PROMPT_FG_GREEN\]\s\[$PROMPT_RESET\]" | |
PROMPT_SECTION_DIRECTORY="\[$PROMPT_UNDERLINE$PROMPT_FG_CYAN\]\W\[$PROMPT_RESET\]" | |
PROMPT_SECTION_GIT_BRANCH="\[$PROMPT_FG_YELLOW\]\`parse_git_branch\`\[$PROMPT_RESET\]" | |
PROMPT_SECTION_ARROW="\[$PROMPT_FG_MAGENTA\]$ARROW\[$PROMPT_RESET\]" | |
# set the prompt string using each section variable | |
PS1=" | |
π $PROMPT_SECTION_SHELL βοΈ $PROMPT_SECTION_DIRECTORY π $PROMPT_SECTION_GIT_BRANCH π | |
$PROMPT_SECTION_ARROW " |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment