diff --git a/themes/THEMES.md b/themes/THEMES.md index 08d75886e..749b44ee2 100644 --- a/themes/THEMES.md +++ b/themes/THEMES.md @@ -175,6 +175,10 @@ [![](nekonight/nekonight-dark.jpg)](nekonight/nekonight-dark.jpg) +## `nekonight_moon` + +[![](nekonight_moon/nekonight_moon-dark.jpg)](nekonight_moon/nekonight_moon-dark.jpg) + ## `nwinkler` [![](nwinkler/nwinkler-dark.png)](nwinkler/nwinkler-dark.png) diff --git a/themes/nekonight/nekonight.base.sh b/themes/nekonight/nekonight.base.sh new file mode 100644 index 000000000..c4753effd --- /dev/null +++ b/themes/nekonight/nekonight.base.sh @@ -0,0 +1,43 @@ +#! bash oh-my-bash.module + +icon_start="╭─" +icon_user=" ${_omb_theme_nekonight_icon_emoji} ${_omb_prompt_bold_olive}\u${_omb_prompt_normal}" +icon_host=" at ${_omb_theme_nekonight_icon_emoji} ${_omb_prompt_bold_cyan}\h${_omb_prompt_normal}" +icon_directory=" in ${_omb_theme_nekonight_icon_emoji} ${_omb_prompt_bold_magenta}\w${_omb_prompt_normal}" +icon_end="╰─${_omb_prompt_bold_white}λ${_omb_prompt_normal}" + +function _omb_theme_nekonight_git_prompt_info() { + local branch_name + branch_name=$(_omb_prompt_git symbolic-ref --short HEAD 2>&-) + local git_status="" + + local icon_emoji="${_omb_theme_nekonight_icon_emoji:-🐱}" + + if [[ -n $branch_name ]]; then + git_status="${_omb_prompt_bold_white} (${icon_emoji} $branch_name $(_omb_theme_nekonight_scm_git_status))${_omb_prompt_normal}" + fi + + echo -n "$git_status" +} + +function _omb_theme_nekonight_scm_git_status() { + local git_status="" + + if _omb_prompt_git rev-list --count --left-right @{upstream}...HEAD 2>&- | grep -Eq '^[0-9]+[[:blank:]][0-9]+$'; then + git_status+="${_omb_prompt_brown}↓${_omb_prompt_normal} " + fi + + if [[ -n $(_omb_prompt_git diff --cached --name-status 2>&-) ]]; then + git_status+="${_omb_prompt_green}+${_omb_prompt_normal}" + fi + + if [[ -n $(_omb_prompt_git diff --name-status 2>&-) ]]; then + git_status+="${_omb_prompt_yellow}•${_omb_prompt_normal}" + fi + + if [[ -n $(_omb_prompt_git ls-files --others --exclude-standard 2>&-) ]]; then + git_status+="${_omb_prompt_red}⌀${_omb_prompt_normal}" + fi + + echo -n "$git_status" +} diff --git a/themes/nekonight/nekonight.theme.sh b/themes/nekonight/nekonight.theme.sh index 4d3e22bc5..778b26a0e 100644 --- a/themes/nekonight/nekonight.theme.sh +++ b/themes/nekonight/nekonight.theme.sh @@ -1,55 +1,18 @@ +#! bash oh-my-bash.module # nekonight Bash prompt with source control management # Author: Bruno Ciccarino # -# # Theme inspired by: # - Bash_it cupcake theme # Demo: # ╭─🐱 virtualenv 🐱user at 🐱host in 🐱directory on (🐱branch {1} ↑1 ↓1 +1 •1 ⌀1 ✗) # ╰λ cd ~/path/to/your-directory -icon_start="╭─" -icon_user=" 🐱 ${_omb_prompt_bold_olive}\u${_omb_prompt_normal}" -icon_host=" at 🐱 ${_omb_prompt_bold_cyan}\h${_omb_prompt_normal}" -icon_directory=" in 🐱 ${_omb_prompt_bold_magenta}\w${_omb_prompt_normal}" -icon_end="╰─${_omb_prompt_bold_white}λ${_omb_prompt_normal}" - -function _omb_theme_nekonight_git_prompt_info() { - local branch_name - branch_name=$(git symbolic-ref --short HEAD 2>/dev/null) - local git_status="" - - if [[ -n $branch_name ]]; then - git_status="${_omb_prompt_bold_white}(🐱 $branch_name $(_omb_theme_nekonight_scm_git_status))${_omb_prompt_normal}" - fi - - echo -n "$git_status" -} - -function _omb_theme_nekonight_scm_git_status() { - local git_status="" +_omb_theme_nekonight_icon_emoji="🐱" - if git rev-list --count --left-right @{upstream}...HEAD 2>/dev/null | grep -Eq '^[0-9]+\s[0-9]+$'; then - git_status+="${_omb_prompt_brown}↓${_omb_prompt_normal} " - fi - - if [[ -n $(git diff --cached --name-status 2>/dev/null) ]]; then - git_status+="${_omb_prompt_green}+${_omb_prompt_normal}" - fi - - if [[ -n $(git diff --name-status 2>/dev/null) ]]; then - git_status+="${_omb_prompt_yellow}•${_omb_prompt_normal}" - fi - - if [[ -n $(git ls-files --others --exclude-standard 2>/dev/null) ]]; then - git_status+="${_omb_prompt_red}⌀${_omb_prompt_normal}" - fi - - echo -n "$git_status" -} +source "$OSH/themes/nekonight/nekonight.base.sh" function _omb_theme_PROMPT_COMMAND() { PS1="${icon_start}${icon_user}${icon_host}${icon_directory} in $(_omb_theme_nekonight_git_prompt_info)\n${icon_end} " } - _omb_util_add_prompt_command _omb_theme_PROMPT_COMMAND diff --git a/themes/nekonight_moon/nekonight_moon-dark.jpg b/themes/nekonight_moon/nekonight_moon-dark.jpg new file mode 100644 index 000000000..5534ab355 Binary files /dev/null and b/themes/nekonight_moon/nekonight_moon-dark.jpg differ diff --git a/themes/nekonight_moon/nekonight_moon.theme.sh b/themes/nekonight_moon/nekonight_moon.theme.sh new file mode 100644 index 000000000..34d4b9dbf --- /dev/null +++ b/themes/nekonight_moon/nekonight_moon.theme.sh @@ -0,0 +1,18 @@ +#! bash oh-my-bash.module +# nekonight-moon Bash prompt with source control management +# Author: Bruno Ciccarino +# +# Theme inspired by: +# - Bash_it cupcake theme +# Demo: +# ╭─🌙 virtualenv 🌙user at 🌙host in 🌙directory on (🌙branch {1} ↑1 ↓1 +1 •1 ⌀1 ✗) +# ╰λ cd ~/path/to/your-directory + +_omb_theme_nekonight_icon_emoji="🌙" + +source "$OSH/themes/nekonight/nekonight.base.sh" + +function _omb_theme_PROMPT_COMMAND() { + PS1="${icon_start}${icon_user}${icon_host}${icon_directory} in $(_omb_theme_nekonight_git_prompt_info)\n${icon_end} " +} +_omb_util_add_prompt_command _omb_theme_PROMPT_COMMAND