2022-01-15 19:00:35 +09:00
|
|
|
#! bash oh-my-bash.module
|
2017-10-10 18:07:01 +07:00
|
|
|
|
|
|
|
# Emoji-based theme to display source control management and
|
|
|
|
# virtual environment info beside the ordinary bash prompt.
|
|
|
|
|
|
|
|
# Theme inspired by:
|
|
|
|
# - Naming your Terminal tabs in OSX Lion - http://thelucid.com/2012/01/04/naming-your-terminal-tabs-in-osx-lion/
|
|
|
|
# - Bash_it sexy theme
|
|
|
|
|
|
|
|
# Demo:
|
|
|
|
# ┌ⓔ virtualenv 💁user @ 💻 host in 📁directory on 🌿branch {1} ↑1 ↓1 +1 •1 ⌀1 ✗
|
|
|
|
# └❯ cd .bash-it/themes/cupcake
|
|
|
|
|
|
|
|
# virtualenv prompts
|
|
|
|
VIRTUALENV_CHAR="ⓔ "
|
|
|
|
VIRTUALENV_THEME_PROMPT_PREFIX=""
|
|
|
|
VIRTUALENV_THEME_PROMPT_SUFFIX=""
|
|
|
|
|
|
|
|
# SCM prompts
|
|
|
|
SCM_NONE_CHAR=""
|
|
|
|
SCM_GIT_CHAR="[±] "
|
2022-01-19 16:52:15 +09:00
|
|
|
SCM_GIT_BEHIND_CHAR="${red}↓${_omb_prompt_normal}"
|
|
|
|
SCM_GIT_AHEAD_CHAR="${_omb_prompt_bold_green}↑${_omb_prompt_normal}"
|
2017-10-10 18:07:01 +07:00
|
|
|
SCM_GIT_UNTRACKED_CHAR="⌀"
|
2022-01-19 16:52:15 +09:00
|
|
|
SCM_GIT_UNSTAGED_CHAR="${_omb_prompt_bold_yellow}•${_omb_prompt_normal}"
|
|
|
|
SCM_GIT_STAGED_CHAR="${_omb_prompt_bold_green}+${_omb_prompt_normal}"
|
2017-10-10 18:07:01 +07:00
|
|
|
|
|
|
|
SCM_THEME_PROMPT_DIRTY=""
|
|
|
|
SCM_THEME_PROMPT_CLEAN=""
|
|
|
|
SCM_THEME_PROMPT_PREFIX=""
|
|
|
|
SCM_THEME_PROMPT_SUFFIX=""
|
|
|
|
|
|
|
|
# Git status prompts
|
2022-01-19 16:52:15 +09:00
|
|
|
GIT_THEME_PROMPT_DIRTY=" ${red}✗${_omb_prompt_normal}"
|
|
|
|
GIT_THEME_PROMPT_CLEAN=" ${_omb_prompt_bold_green}✓${_omb_prompt_normal}"
|
2017-10-10 18:07:01 +07:00
|
|
|
GIT_THEME_PROMPT_PREFIX=""
|
|
|
|
GIT_THEME_PROMPT_SUFFIX=""
|
|
|
|
|
|
|
|
# ICONS =======================================================================
|
|
|
|
|
|
|
|
icon_start="┌"
|
|
|
|
icon_user="💁 "
|
|
|
|
icon_host=" @ 💻 "
|
|
|
|
icon_directory=" in 📁 "
|
|
|
|
icon_branch="🌿"
|
|
|
|
icon_end="└❯ "
|
|
|
|
|
|
|
|
# extra spaces ensure legiblity in prompt
|
|
|
|
|
|
|
|
# FUNCTIONS ===================================================================
|
|
|
|
|
|
|
|
# Rename tab
|
|
|
|
function tabname {
|
|
|
|
printf "\e]1;$1\a"
|
|
|
|
}
|
|
|
|
|
|
|
|
# Rename window
|
|
|
|
function winname {
|
|
|
|
printf "\e]2;$1\a"
|
|
|
|
}
|
|
|
|
|
|
|
|
# PROMPT OUTPUT ===============================================================
|
|
|
|
|
|
|
|
# Displays the current prompt
|
2022-01-11 12:40:43 +09:00
|
|
|
function _omb_theme_PROMPT_COMMAND() {
|
2022-01-19 16:52:15 +09:00
|
|
|
PS1="\n${icon_start}$(_omb_prompt_print_python_venv)${icon_user}${_omb_prompt_bold_red}\u${_omb_prompt_normal}${icon_host}${_omb_prompt_bold_cyan}\h${_omb_prompt_normal}${icon_directory}${_omb_prompt_bold_magenta}\W${_omb_prompt_normal}\$([[ -n \$(git branch 2> /dev/null) ]] && echo \" on ${icon_branch} \")${_omb_prompt_white}$(scm_prompt_info)${_omb_prompt_normal}\n${icon_end}"
|
2017-10-10 18:07:01 +07:00
|
|
|
PS2="${icon_end}"
|
|
|
|
}
|
|
|
|
|
|
|
|
# Runs prompt (this bypasses oh-my-bash $PROMPT setting)
|
2022-01-11 12:40:43 +09:00
|
|
|
_omb_util_add_prompt_command _omb_theme_PROMPT_COMMAND
|