-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnekonight_moon.theme.sh
54 lines (42 loc) · 1.81 KB
/
nekonight_moon.theme.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# nekonight-moon Bash prompt with source control management
# Author: Bruno Ciccarino <brunociccarinoo@gmail.com>
#
# 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=""
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"
}
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