-
-
Save guilhermewop/3801592 to your computer and use it in GitHub Desktop.
Theme for zsh
This file contains 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
# Theme based on: | |
# http://stevelosh.com/blog/2010/02/my-extravagant-zsh-prompt/ | |
# http://fendrich.se/blog/2012/09/28/no/ | |
function prompt_char { | |
git branch >/dev/null 2>/dev/null && echo '±' && return | |
hg root >/dev/null 2>/dev/null && echo '☿' && return | |
echo '%(!.!.➜)' | |
} | |
function get_RAM { | |
free -m | awk '{if (NR==3) print $4}' | xargs -i echo 'scale=1;{}/1000' | bc | |
} | |
function get_nr_jobs() { | |
jobs | wc -l | |
} | |
function get_nr_CPUs() { | |
grep -c "^processor" /proc/cpuinfo | |
} | |
function get_uptime() { | |
uptime | awk '{print $3}' | tr ',' ' ' | |
} | |
PROMPT='%{$fg_bold[green]%}%n@%m %{$fg[cyan]%}%2c %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} %{$fg_bold[red]%}$(prompt_char) % %{$reset_color%}' | |
RPROMPT='%{$fg_bold[red]%}[$(get_nr_jobs), $(get_RAM)G, $(get_uptime)($(get_nr_CPUs))] %{$fg_bold[green]%}%*%{$reset_color%}' | |
ZSH_THEME_GIT_PROMPT_PREFIX="git:(%{$fg[red]%}" | |
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" | |
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%}) %{$fg[yellow]%}!%{$reset_color%}" | |
ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[blue]%}) %{$fg[yellow]%}?%{$reset_color%}" | |
ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%})" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment