Last active
June 20, 2024 14:43
-
-
Save neysimoes/b23bd11962a7f55fc7cd8debbd78f6f0 to your computer and use it in GitHub Desktop.
My theme for Oh My Bash - https://github.com/ohmybash/oh-my-bash
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
# Set term to 256color mode, if 256color is not supported, colors won't work properly | |
if [[ $COLORTERM = gnome-* && $TERM = xterm ]] && infocmp gnome-256color >/dev/null 2>&1; then | |
export TERM=gnome-256color | |
elif infocmp xterm-256color >/dev/null 2>&1; then | |
export TERM=xterm-256color | |
fi | |
# Define custom colors we need | |
# non-printable bytes in PS1 need to be contained within \[ \]. | |
# Otherwise, bash will count them in the length of the prompt | |
function set_custom_colors() { | |
light_red="\[$(tput setaf 160)\]" | |
light_green="\[$(tput setaf 40)\]" | |
} | |
# Initialize custom colors | |
set_custom_colors | |
#! bash oh-my-bash.module | |
SCM_THEME_PROMPT_DIRTY=" ${light_red}✗" | |
SCM_THEME_PROMPT_CLEAN=" ${light_green}✔" | |
SCM_THEME_PROMPT_PREFIX=" " | |
SCM_THEME_PROMPT_SUFFIX="${_omb_prompt_green}" | |
SCM_GIT_SHOW_MINIMAL_INFO="true" | |
GIT_THEME_PROMPT_DIRTY=" ${light_red}✗" | |
GIT_THEME_PROMPT_CLEAN=" ${light_green}✔" | |
GIT_THEME_PROMPT_PREFIX=" ${_omb_prompt_green}" | |
GIT_THEME_PROMPT_SUFFIX="${_omb_prompt_green}" | |
# Nicely formatted terminal prompt | |
function _omb_theme_PROMPT_COMMAND(){ | |
PS1="\n${_omb_prompt_bold_gray}${_omb_prompt_navy}\@${_omb_prompt_bold_gray} " | |
PS1+="${_omb_prompt_bold_gray}${_omb_prompt_green}\u${_omb_prompt_olive} " | |
PS1+="${_omb_prompt_bold_gray}${_omb_prompt_purple}\w${_omb_prompt_bold_gray}" | |
PS1+="$(scm_prompt_info)\n${_omb_prompt_reset_color}▶ " | |
} | |
_omb_util_add_prompt_command _omb_theme_PROMPT_COMMAND |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment