-
Notifications
You must be signed in to change notification settings - Fork 0
/
smyck.zsh.theme
49 lines (40 loc) · 1.35 KB
/
smyck.zsh.theme
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
# -----------------------------------------------------------------------------
# FILE: smyck.zsh-theme
# DESCRIPTION: oh-my-zsh theme file based on the senzshell.zsh-theme
# by Eranga Bandara (https://github.com/erangaeb)
# SHELL: ZSH
# COLORSCHEME: smyck (http://color.smyck.org/)
# AUTHOR: Richard Radermacher ([email protected])
# VERSION: 0.1
# -----------------------------------------------------------------------------
function git_prompt_info() {
ref=$(git symbolic-ref HEAD 2> /dev/null) || return
echo "$(parse_git_dirty)$ZSH_THEME_GIT_PROMPT_PREFIX$(current_branch)$ZSH_THEME_GIT_PROMPT_SUFFIX"
}
function get_pwd() {
print -D $PWD
}
function put_spacing() {
local git=$(git_prompt_info)
if [ ${#git} != 0 ]; then
((git=${#git} - 10))
else
git=0
fi
local termwidth
(( termwidth = ${COLUMNS} - 3 - ${#HOST} - ${#$(get_pwd)} - ${git} ))
local spacing=""
for i in {1..$termwidth}; do
spacing="${spacing} "
done
echo $spacing
}
function precmd() {
print -rP '
$fg[cyan]%m: $fg[yellow]$(get_pwd)$(put_spacing)$(git_prompt_info)'
}
PROMPT='%{$reset_color%}→ '
ZSH_THEME_GIT_PROMPT_PREFIX="[git:"
ZSH_THEME_GIT_PROMPT_SUFFIX="]$reset_color"
ZSH_THEME_GIT_PROMPT_DIRTY="$fg[red]+"
ZSH_THEME_GIT_PROMPT_CLEAN="$fg[green]"