]> git.rmz.io Git - dotfiles.git/blob - zsh/themes/josh.zsh-theme
add xbindkeysrc
[dotfiles.git] / zsh / themes / josh.zsh-theme
1 grey='\e[0;90m'
2
3 ZSH_THEME_GIT_PROMPT_PREFIX="%{$grey%}("
4 ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
5 ZSH_THEME_GIT_PROMPT_DIRTY="%{$grey%}) %{$fg[yellow]%}✗%{$reset_color%}"
6 ZSH_THEME_GIT_PROMPT_CLEAN="%{$grey%})"
7
8 function josh_prompt {
9 (( spare_width = ${COLUMNS} ))
10 prompt=" "
11
12 branch=$(current_branch)
13 ruby_version=$(rvm_prompt_info || rbenv_prompt_info)
14 path_size=${#PWD}
15 branch_size=${#branch}
16 ruby_size=${#ruby_version}
17 user_machine_size=${#${(%):-%n@%m-}}
18
19 if [[ ${#branch} -eq 0 ]]
20 then (( ruby_size = ruby_size + 1 ))
21 else
22 (( branch_size = branch_size + 4 ))
23 if [[ -n $(git status -s 2> /dev/null) ]]; then
24 (( branch_size = branch_size + 2 ))
25 fi
26 fi
27
28 (( spare_width = ${spare_width} - (${user_machine_size} + ${path_size} + ${branch_size} + ${ruby_size}) ))
29
30 while [ ${#prompt} -lt $spare_width ]; do
31 prompt=" $prompt"
32 done
33
34 prompt="%{%F{green}%}$PWD$prompt%{%F{red}%}$(rvm_prompt_info || rbenv_prompt_info)%{$reset_color%} $(git_prompt_info)"
35
36 echo $prompt
37 }
38
39 setopt prompt_subst
40
41 PROMPT='
42 %n@%m $(josh_prompt)
43 %(?,%{%F{green}%},%{%F{red}%})⚡%{$reset_color%} '