Skip to content

Commit 569a6f5

Browse files
feat(themes): adding a new nekonight variant, nekonight_moon (#653)
Co-authored-by: Koichi Murase <myoga.murase@gmail.com>
1 parent e94c7f6 commit 569a6f5

File tree

5 files changed

+68
-40
lines changed

5 files changed

+68
-40
lines changed

themes/THEMES.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,10 @@
175175

176176
[![](nekonight/nekonight-dark.jpg)](nekonight/nekonight-dark.jpg)
177177

178+
## `nekonight_moon`
179+
180+
[![](nekonight_moon/nekonight_moon-dark.jpg)](nekonight_moon/nekonight_moon-dark.jpg)
181+
178182
## `nwinkler`
179183

180184
[![](nwinkler/nwinkler-dark.png)](nwinkler/nwinkler-dark.png)

themes/nekonight/nekonight.base.sh

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#! bash oh-my-bash.module
2+
3+
icon_start="╭─"
4+
icon_user=" ${_omb_theme_nekonight_icon_emoji} ${_omb_prompt_bold_olive}\u${_omb_prompt_normal}"
5+
icon_host=" at ${_omb_theme_nekonight_icon_emoji} ${_omb_prompt_bold_cyan}\h${_omb_prompt_normal}"
6+
icon_directory=" in ${_omb_theme_nekonight_icon_emoji} ${_omb_prompt_bold_magenta}\w${_omb_prompt_normal}"
7+
icon_end="╰─${_omb_prompt_bold_white}λ${_omb_prompt_normal}"
8+
9+
function _omb_theme_nekonight_git_prompt_info() {
10+
local branch_name
11+
branch_name=$(_omb_prompt_git symbolic-ref --short HEAD 2>&-)
12+
local git_status=""
13+
14+
local icon_emoji="${_omb_theme_nekonight_icon_emoji:-🐱}"
15+
16+
if [[ -n $branch_name ]]; then
17+
git_status="${_omb_prompt_bold_white} (${icon_emoji} $branch_name $(_omb_theme_nekonight_scm_git_status))${_omb_prompt_normal}"
18+
fi
19+
20+
echo -n "$git_status"
21+
}
22+
23+
function _omb_theme_nekonight_scm_git_status() {
24+
local git_status=""
25+
26+
if _omb_prompt_git rev-list --count --left-right @{upstream}...HEAD 2>&- | grep -Eq '^[0-9]+[[:blank:]][0-9]+$'; then
27+
git_status+="${_omb_prompt_brown}${_omb_prompt_normal} "
28+
fi
29+
30+
if [[ -n $(_omb_prompt_git diff --cached --name-status 2>&-) ]]; then
31+
git_status+="${_omb_prompt_green}+${_omb_prompt_normal}"
32+
fi
33+
34+
if [[ -n $(_omb_prompt_git diff --name-status 2>&-) ]]; then
35+
git_status+="${_omb_prompt_yellow}${_omb_prompt_normal}"
36+
fi
37+
38+
if [[ -n $(_omb_prompt_git ls-files --others --exclude-standard 2>&-) ]]; then
39+
git_status+="${_omb_prompt_red}${_omb_prompt_normal}"
40+
fi
41+
42+
echo -n "$git_status"
43+
}
Lines changed: 3 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,18 @@
1+
#! bash oh-my-bash.module
12
# nekonight Bash prompt with source control management
23
# Author: Bruno Ciccarino <brunociccarinoo@gmail.com>
34
#
4-
#
55
# Theme inspired by:
66
# - Bash_it cupcake theme
77
# Demo:
88
# ╭─🐱 virtualenv 🐱user at 🐱host in 🐱directory on (🐱branch {1} ↑1 ↓1 +1 •1 ⌀1 ✗)
99
# ╰λ cd ~/path/to/your-directory
1010

11-
icon_start="╭─"
12-
icon_user=" 🐱 ${_omb_prompt_bold_olive}\u${_omb_prompt_normal}"
13-
icon_host=" at 🐱 ${_omb_prompt_bold_cyan}\h${_omb_prompt_normal}"
14-
icon_directory=" in 🐱 ${_omb_prompt_bold_magenta}\w${_omb_prompt_normal}"
15-
icon_end="╰─${_omb_prompt_bold_white}λ${_omb_prompt_normal}"
16-
17-
function _omb_theme_nekonight_git_prompt_info() {
18-
local branch_name
19-
branch_name=$(git symbolic-ref --short HEAD 2>/dev/null)
20-
local git_status=""
21-
22-
if [[ -n $branch_name ]]; then
23-
git_status="${_omb_prompt_bold_white}(🐱 $branch_name $(_omb_theme_nekonight_scm_git_status))${_omb_prompt_normal}"
24-
fi
25-
26-
echo -n "$git_status"
27-
}
28-
29-
function _omb_theme_nekonight_scm_git_status() {
30-
local git_status=""
11+
_omb_theme_nekonight_icon_emoji="🐱"
3112

32-
if git rev-list --count --left-right @{upstream}...HEAD 2>/dev/null | grep -Eq '^[0-9]+\s[0-9]+$'; then
33-
git_status+="${_omb_prompt_brown}${_omb_prompt_normal} "
34-
fi
35-
36-
if [[ -n $(git diff --cached --name-status 2>/dev/null) ]]; then
37-
git_status+="${_omb_prompt_green}+${_omb_prompt_normal}"
38-
fi
39-
40-
if [[ -n $(git diff --name-status 2>/dev/null) ]]; then
41-
git_status+="${_omb_prompt_yellow}${_omb_prompt_normal}"
42-
fi
43-
44-
if [[ -n $(git ls-files --others --exclude-standard 2>/dev/null) ]]; then
45-
git_status+="${_omb_prompt_red}${_omb_prompt_normal}"
46-
fi
47-
48-
echo -n "$git_status"
49-
}
13+
source "$OSH/themes/nekonight/nekonight.base.sh"
5014

5115
function _omb_theme_PROMPT_COMMAND() {
5216
PS1="${icon_start}${icon_user}${icon_host}${icon_directory} in $(_omb_theme_nekonight_git_prompt_info)\n${icon_end} "
5317
}
54-
5518
_omb_util_add_prompt_command _omb_theme_PROMPT_COMMAND
35 KB
Loading
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#! bash oh-my-bash.module
2+
# nekonight-moon Bash prompt with source control management
3+
# Author: Bruno Ciccarino <brunociccarinoo@gmail.com>
4+
#
5+
# Theme inspired by:
6+
# - Bash_it cupcake theme
7+
# Demo:
8+
# ╭─🌙 virtualenv 🌙user at 🌙host in 🌙directory on (🌙branch {1} ↑1 ↓1 +1 •1 ⌀1 ✗)
9+
# ╰λ cd ~/path/to/your-directory
10+
11+
_omb_theme_nekonight_icon_emoji="🌙"
12+
13+
source "$OSH/themes/nekonight/nekonight.base.sh"
14+
15+
function _omb_theme_PROMPT_COMMAND() {
16+
PS1="${icon_start}${icon_user}${icon_host}${icon_directory} in $(_omb_theme_nekonight_git_prompt_info)\n${icon_end} "
17+
}
18+
_omb_util_add_prompt_command _omb_theme_PROMPT_COMMAND

0 commit comments

Comments
 (0)