Created
September 28, 2012 14:05
-
-
Save gurgeh/3800072 to your computer and use it in GitHub Desktop.
Gurgeh's Zsh prompt
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 prompt_char { | |
git branch >/dev/null 2>/dev/null && echo '±' && return | |
hg root >/dev/null 2>/dev/null && echo '☿' && return | |
echo '%(!.!.➜)' | |
} | |
function parse_hg_dirty { | |
if [[ -n $(hg status -mard . 2> /dev/null) ]]; then | |
echo "$ZSH_THEME_HG_PROMPT_DIRTY" | |
fi | |
} | |
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_load() { | |
uptime | awk '{print $11}' | tr ',' ' ' | |
} | |
PROMPT='%{$fg_bold[green]%}%n@%m %{$fg[cyan]%}%2c %{$fg_bold[blue]%}$(git_prompt_info)$(parse_hg_dirty)%{$fg_bold[blue]%} %{$fg_bold[red]%}$(prompt_char) % %{$reset_color%}' | |
RPROMPT='%{$fg_bold[red]%}[$(get_nr_jobs), $(get_RAM)G, $(get_load)($(get_nr_CPUs))] %{$fg_bold[green]%}%*%{$reset_color%}' | |
ZSH_THEME_HG_PROMPT_PREFIX="hg:(%{$fg[red]%}" | |
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_HG_PROMPT_DIRTY="%{$fg[yellow]%}✗%{$reset_color%}" | |
ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%})" |
If you use Oh my zsh, you put it in .oh-my-zsh/themes and name it something
like gurgeh.zsh-theme
…On Fri, Nov 1, 2019 at 7:26 PM Sal Abuewilly ***@***.***> wrote:
Where do I place this? .zshrc ?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<https://gist.github.com/3800072?email_source=notifications&email_token=AAEIHALVO7U2Z2AMKSFWS5TQRRYEJA5CNFSM4JH6NRBKYY3PNVWWK3TUL52HS4DFVNDWS43UINXW23LFNZ2KUY3PNVWWK3TUL5UWJTQAF3QGS#gistcomment-3072105>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAEIHAM42EFBIG4TEPYUUSDQRRYEJANCNFSM4JH6NRBA>
.
--
0xDF - ß
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Where do I place this? .zshrc ?