Skip to content

Instantly share code, notes, and snippets.

@guilhermewop
Forked from gurgeh/gist:3800072
Last active October 11, 2015 04:17
Show Gist options
  • Save guilhermewop/3801592 to your computer and use it in GitHub Desktop.
Save guilhermewop/3801592 to your computer and use it in GitHub Desktop.
Theme for zsh
# 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