Last active
November 17, 2020 12:01
-
-
Save gabriel-nsiqueira/c7182a9aa5769e655682c6b40a9368a1 to your computer and use it in GitHub Desktop.
This is the zsh theme I use, this should be placed at your $ZSH_CUSTOM/themes directory
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
# GIT | |
GIT_PROMPT_PREFIX1=" %{$terminfo[bold]$fg[blue]%}on%{$reset_color%} " | |
GIT_PROMPT_PREFIX2="%{$terminfo[bold]$fg[magenta]%}:%{$terminfo[bold]$fg[yellow]%}" | |
GIT_PROMPT_SUFFIX="%{$reset_color%}" | |
GIT_PROMPT_DIRTY=" %{$terminfo[bold]$fg[red]%}✗%{$reset_color%}" | |
GIT_PROMPT_CLEAN=" %{$terminfo[bold]$fg[green]%}✔%{$reset_color%}" | |
# Git info | |
local git_info='$(git_prompt_info)' | |
ZSH_THEME_GIT_PROMPT_PREFIX="${GIT_PROMPT_PREFIX1}%{$terminfo[bold]$fg[green]%}git${GIT_PROMPT_PREFIX2}" | |
ZSH_THEME_GIT_PROMPT_SUFFIX="$GIT_PROMPT_SUFFIX" | |
ZSH_THEME_GIT_PROMPT_DIRTY="$GIT_PROMPT_DIRTY" | |
ZSH_THEME_GIT_PROMPT_CLEAN="$GIT_PROMPT_CLEAN" | |
# Check code | |
local return_status="%(?:%{$fg_bold[green]%}π:%{$fg_bold[red]%}π)" | |
local hg_info='$(hg_prompt_info)' | |
hg_prompt_info() { | |
# make sure this is a hg dir | |
if [ -d '.hg' ]; then | |
echo -n "${GIT_PROMPT_PREFIX1}hg${GIT_PROMPT_PREFIX2}" | |
echo -n $(hg branch 2>/dev/null) | |
if [ -n "$(hg status 2>/dev/null)" ]; then | |
echo -n "$GIT_PROMPT_DIRTY" | |
else | |
echo -n "$GIT_PROMPT_CLEAN" | |
fi | |
echo -n "$GIT_PROMPT_SUFFIX" | |
fi | |
} | |
PROMPT=" | |
%(#,%{$bg[yellow]%}%{$fg[black]%}%n%{$reset_color%},%{$terminfo[bold]$fg[yellow]%}%n) \ | |
%{$fg[blue]%}in \ | |
%{$terminfo[bold]$fg[cyan]%}%~%{$reset_color%}\ | |
${hg_info}\ | |
${git_info} | |
\ | |
%{$terminfo[bold]$fg[green]%}❱ %{$reset_color%}" | |
if [[ "$NT_HIDE_EXIT_CODE" == '1' ]]; then | |
RPROMPT='' | |
else | |
RPROMPT='%(?..%F{red}%B%S $? %s%b%f)' | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment