Skip to content

Instantly share code, notes, and snippets.

@rg3915
Last active February 9, 2026 03:44
Show Gist options
  • Select an option

  • Save rg3915/2d050e62edffcb5094c73b19beca4632 to your computer and use it in GitHub Desktop.

Select an option

Save rg3915/2d050e62edffcb5094c73b19beca4632 to your computer and use it in GitHub Desktop.
my bash-it bashit
# shellcheck shell=bash
# shellcheck disable=SC2034 # Expected behavior for themes.
SCM_THEME_PROMPT_DIRTY=" ${red?}"
SCM_THEME_PROMPT_CLEAN=" ${bold_green?}"
SCM_THEME_PROMPT_PREFIX=" ("
SCM_THEME_PROMPT_SUFFIX="${green?})"
GIT_THEME_PROMPT_DIRTY=" ${red?}"
GIT_THEME_PROMPT_CLEAN=" ${bold_green?}"
GIT_THEME_PROMPT_PREFIX="${green?}|"
GIT_THEME_PROMPT_SUFFIX="${green?}|"
VIRTUALENV_THEME_PROMPT_PREFIX="("
VIRTUALENV_THEME_PROMPT_SUFFIX=") "
function prompt_command() {
PS1="${yellow?}$(python_version_prompt) " # Name of virtual env followed by python version
PS1+="${blue?}\w "
PS1+="${green?}$(scm_prompt_info) "
PS1+="${green?}\$ ${reset_color?}"
}
safe_append_prompt_command prompt_command
# shellcheck shell=bash
# shellcheck disable=SC2034 # Expected behavior for themes.
# Laranja real (256-color)
_orange="\[\e[38;5;208m\]"
SCM_THEME_PROMPT_DIRTY=" ${red?}"
SCM_THEME_PROMPT_CLEAN=" ${bold_green?}"
SCM_THEME_PROMPT_PREFIX=" |"
SCM_THEME_PROMPT_SUFFIX="${green?}|"
GIT_THEME_PROMPT_DIRTY=" ${red?}"
GIT_THEME_PROMPT_CLEAN=" ${bold_green?}"
GIT_THEME_PROMPT_PREFIX=" ${green?}|"
GIT_THEME_PROMPT_SUFFIX="${green?}|"
function _py_version_prompt() {
local py_version
py_version=$(python3 --version 2>/dev/null | sed 's/Python /py-/')
if [[ -n "$py_version" ]]; then
echo -ne "${_orange?}${py_version}${reset_color?}"
fi
}
function _venv_prompt() {
if [[ -n "${VIRTUAL_ENV:-}" ]]; then
local venv_name="${VIRTUAL_ENV##*/}"
echo -ne "${_orange?}(${venv_name}) ${reset_color?}"
fi
}
function _last_dir() {
echo -ne "/${PWD##*/}"
}
function prompt_command() {
PS1="\n$(_venv_prompt)$(_py_version_prompt) ${blue?}\w${reset_color?}\n${blue?}$(_last_dir) ${bold_cyan?}$(scm_char)${green?}$(scm_prompt_info) ${green?}${reset_color?} "
}
safe_append_prompt_command prompt_command
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment