diff options
author | NanoTech <nanotech008@gmail.com> | 2010-09-30 22:23:50 -0600 |
---|---|---|
committer | NanoTech <nanotech008@gmail.com> | 2010-09-30 22:23:50 -0600 |
commit | 02c5fd5bdd0d37bb0e1cb19ad058154f5b7d96a7 (patch) | |
tree | 2c44274cce756577225ab895d04f004231a04e25 /themes/josh.zsh-theme | |
parent | 8c419ae3b5b77a24485c6a68e6af1a0384db67a8 (diff) | |
parent | 7a09175bb4c32c7027dab872cd7b80503da3f5d5 (diff) | |
download | zsh-02c5fd5bdd0d37bb0e1cb19ad058154f5b7d96a7.tar.gz zsh-02c5fd5bdd0d37bb0e1cb19ad058154f5b7d96a7.tar.bz2 zsh-02c5fd5bdd0d37bb0e1cb19ad058154f5b7d96a7.zip |
Merge branch 'master' of git://github.com/robbyrussell/oh-my-zsh
Diffstat (limited to 'themes/josh.zsh-theme')
-rw-r--r-- | themes/josh.zsh-theme | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/themes/josh.zsh-theme b/themes/josh.zsh-theme new file mode 100644 index 000000000..6bed1a70e --- /dev/null +++ b/themes/josh.zsh-theme @@ -0,0 +1,43 @@ +grey='\e[0;90m' + +ZSH_THEME_GIT_PROMPT_PREFIX="%{$grey%}(" +ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_DIRTY="%{$grey%}) %{$fg[yellow]%}✗%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_CLEAN="%{$grey%})" + +function josh_prompt { + (( spare_width = ${COLUMNS} )) + prompt=" " + + branch=$(current_branch) + ruby_version=$(rvm_prompt_info) + path_size=${#PWD} + branch_size=${#branch} + ruby_size=${#ruby_version} + user_machine_size=${#${(%):-%n@%m-}} + + if [[ ${#branch} -eq 0 ]] + then (( ruby_size = ruby_size + 1 )) + else + (( branch_size = branch_size + 4 )) + if [[ -n $(git status -s 2> /dev/null) ]]; then + (( branch_size = branch_size + 2 )) + fi + fi + + (( spare_width = ${spare_width} - (${user_machine_size} + ${path_size} + ${branch_size} + ${ruby_size}) )) + + while [ ${#prompt} -lt $spare_width ]; do + prompt=" $prompt" + done + + prompt="%{%F{green}%}$PWD$prompt%{%F{red}%}$(rvm_prompt_info)%{$reset_color%} $(git_prompt_info)" + + echo $prompt +} + +setopt prompt_subst + +PROMPT=' +%n@%m $(josh_prompt) +%(?,%{%F{green}%},%{%F{red}%})⚡%{$reset_color%} ' |