-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathksposh.zsh-theme
More file actions
127 lines (103 loc) · 3.45 KB
/
ksposh.zsh-theme
File metadata and controls
127 lines (103 loc) · 3.45 KB
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
#!/bin/sh
# prompt style and colors based of Steve Losh's Prose theme:
# https://github.com/sjl/oh-my-zsh/blob/master/themes/prose.zsh-theme
# git status configurations based of Sal Ferrarello's guide:
# https://salferrarello.com/zsh-git-status-prompt/
# git untracted configuration from:
# https://github.com/zsh-users/zsh/blob/f9e9dce5443f323b340303596406f9d3ce11d23a/Misc/vcs_info-examples#L155-L170
# https://github.com/zsh-users/zsh/blob/f9e9dce5443f323b340303596406f9d3ce11d23a/Functions/VCS_Info/VCS_INFO_formats#L37-L50
# virtualenv configurations from:
# https://github.com/ohmyzsh/ohmyzsh/blob/master/plugins/virtualenv/virtualenv.plugin.zsh
# color codes from:
# https://www.ditig.com/publications/256-colors-cheat-sheet
# author: José Dias <ksposh>
## ---
## Functions
## ---
+vi-acquire-git-change-info() {
if git rev-parse --is-inside-work-tree >/dev/null 2>&1; then
case "$(git rev-parse --show-toplevel 2>/dev/null)" in
*/.cache/*) ;;
*)
count_staged="$(git diff-index --cached --name-only HEAD | wc -l)"
count_unstaged="$(git diff-files --name-only | wc -l)"
count_untracked="$(git ls-files --other --exclude-standard | wc -l)"
[ "$count_staged" -gt 0 ] && hook_com[staged]+="$count_staged"
[ "$count_unstaged" -gt 0 ] && hook_com[unstaged]+="$count_unstaged"
hook_com[misc]="" # Empty misc to not get artifacts in git action
[ "$count_untracked" -gt 0 ] && hook_com[misc]=" ${color_red}?$count_untracked"
;;
esac
fi
}
__zsh_virtualenv_prompt() {
[ -z "$VIRTUAL_ENV" ] && return
if [ -n "$VIRTUAL_ENV_PROMPT" ]; then
env_name=$VIRTUAL_ENV_PROMPT
elif [ -n "$VIRTUAL_ENV" ]; then
env_name=$(basename "$VIRTUAL_ENV" | sed 's/%/%%/g')
fi
echo "${ZSH_THEME_VIRTUALENV_PREFIX:-[}$env_name${ZSH_THEME_VIRTUALENV_SUFFIX:-]}"
}
## ---
## Color Scheme
## ---
case "$TERM" in
*256color)
color_blue="%F{063}"
color_cyan="%F{081}"
color_green="%F{082}"
color_orange="%F{202}"
color_purple="%F{135}"
color_red="%F{009}"
;;
*)
color_blue="%F{blue}"
color_cyan="%F{cyan}"
color_green="%F{green}"
color_orange="%F{yellow}"
color_purple="%F{magenta}"
color_red="%F{red}"
;;
esac
## ---
## Markers
## ---
marker_user="${color_purple}%n"
marker_path="${color_green}%~"
marker_separator="${color_orange}»"
marker_less="${color_orange}<"
marker_more="${color_orange}>"
marker_split="${color_orange}§"
## ---
## Version Control (Git) Configurations
## ---
autoload -Uz vcs_info add-zsh-hook
setopt prompt_subst
add-zsh-hook precmd vcs_info
zstyle ':vcs_info:git*+set-message:*' hooks acquire-git-change-info
zstyle ':vcs_info:git:*' formats " ${marker_separator} ${color_cyan}%b%m%u%c"
zstyle ':vcs_info:git:*' actionformats " ${marker_separator} ${color_cyan}%b%m%u%c ${marker_more}${color_blue}%a${marker_less}"
zstyle ':vcs_info:*' stagedstr " ${color_green}▲"
zstyle ':vcs_info:*' unstagedstr " ${color_orange}▼"
zstyle ':vcs_info:*' nvcsformats ""
zstyle ':vcs_info:*' check-for-changes true
## ---
## Python Virtual Env Variables
## ---
ZSH_THEME_VIRTUALENV_PREFIX=" ${color_red}"
ZSH_THEME_VIRTUALENV_SUFFIX=" ${marker_separator}"
VIRTUAL_ENV_DISABLE_PROMPT=1
## ---
## PROMPT
## Comment out what needs to be disabled
## Don't include spacing for function edits
## ---
PROMPT=""
PROMPT+="\$(__zsh_virtualenv_prompt)"
PROMPT+=" ${marker_user}"
PROMPT+=" ${marker_separator}"
PROMPT+=" ${marker_path}"
PROMPT+="\${vcs_info_msg_0_}"
PROMPT+=" ${marker_split}"
PROMPT+=" %{$reset_color%}"