Last active
December 30, 2015 00:29
-
-
Save mdeous/7750103 to your computer and use it in GitHub Desktop.
zsh theme
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function loadavg_info() { | |
| local -h one five fifteen rest | |
| read one five fifteen rest < /proc/loadavg | |
| print "$one $five $fifteen" | |
| } | |
| function prompt_char { | |
| if [[ `whoami` == 'root' ]]; then | |
| print "#" | |
| else | |
| print "\$" | |
| fi | |
| } | |
| git_prompt_info () { | |
| ref=$(git symbolic-ref HEAD 2> /dev/null) || return | |
| echo "$ZSH_THEME_GIT_PROMPT_PREFIX${ref#refs/heads/}$(parse_git_dirty)$ZSH_THEME_GIT_PROMPT_SUFFIX" | |
| } | |
| parse_git_dirty () { | |
| if [[ -n $(git status -s 2> /dev/null) ]] | |
| then | |
| echo "$ZSH_THEME_GIT_PROMPT_DIRTY" | |
| else | |
| echo "$ZSH_THEME_GIT_PROMPT_CLEAN" | |
| fi | |
| } | |
| PROMPT_HOST="%{$fg_bold[green]%}(%n%{$reset_color%}@%{$fg_bold[green]%}%m)%{$reset_color%}" | |
| PROMPT_DATE="%{$fg[blue]%}[%*]%{$reset_color%}" | |
| PROMPT_INPUT="%{$fg[blue]%}-> %{$fg_bold[blue]%}$(prompt_char)%{$reset_color%}" | |
| PROMPT_PATH="%{$fg[white]%}[%~]%{$reset_color%}" | |
| PROMPT_LOADAVG="%{$fg[magenta]%}[$(loadavg_info)]%{$reset_color%}" | |
| PROMPT='$PROMPT_HOST $PROMPT_PATH $PROMPT_DATE $PROMPT_LOADAVG $(git_prompt_info) | |
| $PROMPT_INPUT ' | |
| ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[green]%}[git:" | |
| ZSH_THEME_GIT_PROMPT_SUFFIX="%{$fg[green]%}]%{$reset_color%}" | |
| ZSH_THEME_GIT_PROMPT_DIRTY=" %{$fg_bold[red]%}✘%{$reset_color%}" | |
| ZSH_THEME_GIT_PROMPT_UNTRACKED=" %{$fg_bold[red]%}±%{$reset_color%}" | |
| ZSH_THEME_GIT_PROMPT_CLEAN=" %{$fg_bold[green]%}✔%{$reset_color%}" | |
| # vim: set ts=8 sw=4 ft=zsh : |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment