This commit is contained in:
Eder Ruiz Maria 2012-10-13 18:55:29 -07:00
commit f07e75ed41
3 changed files with 63 additions and 18 deletions

View file

@ -1,7 +1,10 @@
# get the name of the branch we are on
function 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"
if ! git status &> /dev/null; then
return
fi
branch=$(git branch | grep ^\* | cut -d" " -f2-)
echo "$ZSH_THEME_GIT_PROMPT_PREFIX${branch}$(parse_git_dirty)$ZSH_THEME_GIT_PROMPT_SUFFIX"
}
@ -38,6 +41,9 @@ function git_prompt_long_sha() {
# Get the status of the working tree
git_prompt_status() {
if ! git status &> /dev/null; then
return
fi
INDEX=$(git status --porcelain 2> /dev/null)
STATUS=""
if $(echo "$INDEX" | grep '^?? ' &> /dev/null); then
@ -66,6 +72,8 @@ git_prompt_status() {
if $(echo "$INDEX" | grep '^UU ' &> /dev/null); then
STATUS="$ZSH_THEME_GIT_PROMPT_UNMERGED$STATUS"
fi
STATUS="$ZSH_THEME_GIT_PROMPT_STATUS_PREFIX$STATUS"
STATUS+="$ZSH_THEME_GIT_PROMPT_STATUS_SUFFIX"
echo $STATUS
}

31
themes/uhet.zsh-theme Normal file
View file

@ -0,0 +1,31 @@
function do_RPROMPT()
{
RPROMPT='$(git_prompt_status)$(git_prompt_info)'
}
function do_PROMPT()
{
local user='%(!.%{$fg_bold[red]%}.%{$fg_bold[green]%}%n@)'
local host='%m%{$reset_color%}'
local dir='%{$fg_bold[blue]%}%~%{$reset_color%}%(!.#.$) '
PROMPT="${user}${host}:${dir}"
}
ZSH_THEME_GIT_PROMPT_STATUS_PREFIX="%{$fg_bold[red]%}["
ZSH_THEME_GIT_PROMPT_STATUS_SUFFIX=""
ZSH_THEME_GIT_PROMPT_ADDED="✚%{$fg_bold[green]%}"
ZSH_THEME_GIT_PROMPT_MODIFIED="✹%{$fg_bold[blue]%}"
ZSH_THEME_GIT_PROMPT_DELETED="✖%{$fg_bold[red]%}"
ZSH_THEME_GIT_PROMPT_RENAMED="➜%{$fg_bold[magenta]%}"
ZSH_THEME_GIT_PROMPT_UNMERGED="═%{$fg_bold[yellow]%}"
ZSH_THEME_GIT_PROMPT_UNTRACKED="✭%{$fg_bold[cyan]%}"
ZSH_THEME_GIT_PROMPT_NOTHING=""
ZSH_THEME_GIT_PROMPT_PREFIX=""
ZSH_THEME_GIT_PROMPT_DIRTY=""
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$fg_bold[red]%}]%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_CLEAN=""
do_PROMPT
do_RPROMPT

View file

@ -1,39 +1,45 @@
ECHO="echo"
if echo ${SHELL} | grep -q bash
then
ECHO="echo -e"
fi
if [ -d ~/.oh-my-zsh ]
then
echo "\033[0;33mYou already have Oh My Zsh installed.\033[0m You'll need to remove ~/.oh-my-zsh if you want to install"
${ECHO} "\033[0;33mYou already have Oh My Zsh installed.\033[0m You'll need to remove ~/.oh-my-zsh if you want to install"
exit
fi
echo "\033[0;34mCloning Oh My Zsh...\033[0m"
${ECHO} "\033[0;34mCloning Oh My Zsh...\033[0m"
hash git >/dev/null && /usr/bin/env git clone https://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh || {
echo "git not installed"
${ECHO} "git not installed"
exit
}
echo "\033[0;34mLooking for an existing zsh config...\033[0m"
${ECHO} "\033[0;34mLooking for an existing zsh config...\033[0m"
if [ -f ~/.zshrc ] || [ -h ~/.zshrc ]
then
echo "\033[0;33mFound ~/.zshrc.\033[0m \033[0;32]Backing up to ~/.zshrc.pre-oh-my-zsh\033[0m";
${ECHO} "\033[0;33mFound ~/.zshrc.\033[0m \033[0;32]Backing up to ~/.zshrc.pre-oh-my-zsh\033[0m";
cp ~/.zshrc ~/.zshrc.pre-oh-my-zsh;
rm ~/.zshrc;
fi
echo "\033[0;34mUsing the Oh My Zsh template file and adding it to ~/.zshrc\033[0m"
${ECHO} "\033[0;34mUsing the Oh My Zsh template file and adding it to ~/.zshrc\033[0m"
cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc
echo "\033[0;34mCopying your current PATH and adding it to the end of ~/.zshrc for you.\033[0m"
echo "export PATH=$PATH" >> ~/.zshrc
${ECHO} "\033[0;34mCopying your current PATH and adding it to the end of ~/.zshrc for you.\033[0m"
${ECHO} "export PATH=$PATH" >> ~/.zshrc
echo "\033[0;34mTime to change your default shell to zsh!\033[0m"
${ECHO} "\033[0;34mTime to change your default shell to zsh!\033[0m"
chsh -s `which zsh`
echo "\033[0;32m"' __ __ '"\033[0m"
echo "\033[0;32m"' ____ / /_ ____ ___ __ __ ____ _____/ /_ '"\033[0m"
echo "\033[0;32m"' / __ \/ __ \ / __ `__ \/ / / / /_ / / ___/ __ \ '"\033[0m"
echo "\033[0;32m"'/ /_/ / / / / / / / / / / /_/ / / /_(__ ) / / / '"\033[0m"
echo "\033[0;32m"'\____/_/ /_/ /_/ /_/ /_/\__, / /___/____/_/ /_/ '"\033[0m"
echo "\033[0;32m"' /____/ '"\033[0m"
${ECHO} "\033[0;32m"' __ __ '"\033[0m"
${ECHO} "\033[0;32m"' ____ / /_ ____ ___ __ __ ____ _____/ /_ '"\033[0m"
${ECHO} "\033[0;32m"' / __ \/ __ \ / __ `__ \/ / / / /_ / / ___/ __ \ '"\033[0m"
${ECHO} "\033[0;32m"'/ /_/ / / / / / / / / / / /_/ / / /_(__ ) / / / '"\033[0m"
${ECHO} "\033[0;32m"'\____/_/ /_/ /_/ /_/ /_/\__, / /___/____/_/ /_/ '"\033[0m"
${ECHO} "\033[0;32m"' /____/ '"\033[0m"
echo "\n\n \033[0;32m....is now installed.\033[0m"
${ECHO} "\n\n \033[0;32m....is now installed.\033[0m"
/usr/bin/env zsh
source ~/.zshrc