Skip to content

Instantly share code, notes, and snippets.

@gedzeppelin
Last active June 1, 2021 07:04
Show Gist options
  • Save gedzeppelin/959a3f48a486e79e6170cd593386e164 to your computer and use it in GitHub Desktop.
Save gedzeppelin/959a3f48a486e79e6170cd593386e164 to your computer and use it in GitHub Desktop.
Simple zsh theme with cloud anotation.
# Functions
git_prompt_info() {
inside_git_repo="$(git rev-parse --is-inside-work-tree 2>/dev/null)"
if [ "$inside_git_repo" ]; then
branch=$(git branch | awk '/^\*/ { print $2 }')
echo "%{$RESET%}, in %{$GREEN%}$branch%{$RESET%} branch"
else
echo ""
fi;
}
get_dir() {
if [ "$(pwd)" = "$(eval echo ~$(id -n -u))" ]; then
echo "~/"
else
echo "%3~"
fi;
}
# Colors
RESET=$(echo '\033[0m')
BLUE=$(echo '\033[1;38;5;51m')
ORANGE=$(echo '\033[1;38;5;215m')
VIOLET=$(echo '\033[1;38;5;111m')
PINK=$(echo '\033[1;38;5;218m')
GREEN=$(echo '\033[1;38;5;119m')
RED=$(echo '\033[1;38;5;9m')
# Custom prompt
PROMPT=$'%(?:%{$GREEN%}:%{$RED%})[%{$BLUE%}%T%(?:%{$GREEN%}:%{$RED%})] %(!.%{$RED%}.%{$ORANGE%})%n%{$RESET%} at %{$RED%}CLOUD:%{$VIOLET%}%m$(git_prompt_info) %(?:%{$GREEN%}:%{$RED%})[%{$BLUE%}$(get_dir)%(?:%{$GREEN%}:%{$RED%})]
─▶%{$RESET%} '
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment