Commit 2595484a authored by Sébastien M-B's avatar Sébastien M-B
Browse files

Merge remote-tracking branch 'upstream/master'

Conflicts:
	lib/aliases.zsh
parents 8d23a361 6e6cf430
......@@ -46,7 +46,8 @@ function ssh_connection() {
fi
}
PROMPT=$'\n$(ssh_connection)%{$fg_bold[green]%}%n@%m%{$reset_color%}$(my_git_prompt) : %~\n%# '
local ret_status="%(?:%{$fg_bold[green]%}:%{$fg_bold[red]%})%?%{$reset_color%}"
PROMPT=$'\n$(ssh_connection)%{$fg_bold[green]%}%n@%m%{$reset_color%}$(my_git_prompt) : %~\n[${ret_status}] %# '
ZSH_THEME_PROMPT_RETURNCODE_PREFIX="%{$fg_bold[red]%}"
ZSH_THEME_GIT_PROMPT_PREFIX=" $fg[white]‹ %{$fg_bold[yellow]%}"
......
PROMPT='%{$fg[yellow]%}λ %{$fg[green]%}%c %{$fg[yellow]%}→ $(git_prompt_info)%{$reset_color%}'
PROMPT='%{$fg[yellow]%}λ %m %{$fg[green]%}%c %{$fg[yellow]%}→ $(git_prompt_info)%{$reset_color%}'
ZSH_THEME_GIT_PROMPT_PREFIX="λ %{$fg[blue]%}git %{$fg[red]%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$fg[yellow]%} → %{$reset_color%}"
# Prompt
#
# Below are the color init strings for the basic file types. A color init
# string consists of one or more of the following numeric codes:
# Attribute codes:
# 00=none 01=bold 04=underscore 05=blink 07=reverse 08=concealed
# Text color codes:
# 30=black 31=red 32=green 33=yellow 34=blue 35=magenta 36=cyan 37=white
# Background color codes:
# 40=black 41=red 42=green 43=yellow 44=blue 45=magenta 46=cyan 47=white
function precmd {
local TERMWIDTH
(( TERMWIDTH = ${COLUMNS} - 1 ))
###
# Truncate the path if it's too long.
PR_FILLBAR=""
PR_PWDLEN=""
local promptsize=${#${(%):---(%n@%M:%l)---()}}
local pwdsize=${#${(%):-%~}}
local gitbranch="$(git_prompt_info)"
local rvmprompt="$(rvm_prompt_info)"
local gitbranchsize=${#${gitbranch:-''}}
local rvmpromptsize=${#${rvmprompt:-''}}
if [[ "$promptsize + $pwdsize + $rvmpromptsize + $gitbranchsize" -gt $TERMWIDTH ]]; then
((PR_PWDLEN=$TERMWIDTH - $promptsize))
else
PR_FILLBAR="\${(l.(($TERMWIDTH - ($promptsize + $pwdsize + $rvmpromptsize + $gitbranchsize)))..${PR_SPACE}.)}"
fi
}
setopt extended_glob
preexec () {
if [[ "$TERM" == "screen" ]]; then
local CMD=${1[(wr)^(*=*|sudo|-*)]}
echo -n "\ek$CMD\e\\"
fi
if [[ "$TERM" == "xterm" ]]; then
print -Pn "\e]0;$1\a"
fi
if [[ "$TERM" == "rxvt" ]]; then
print -Pn "\e]0;$1\a"
fi
}
setprompt () {
###
# Need this so the prompt will work.
setopt prompt_subst
###
# See if we can use colors.
autoload colors zsh/terminfo
if [[ "$terminfo[colors]" -ge 8 ]]; then
colors
fi
for color in RED GREEN YELLOW BLUE MAGENTA CYAN WHITE; do
eval PR_$color='%{$terminfo[bold]$fg[${(L)color}]%}'
eval PR_LIGHT_$color='%{$fg[${(L)color}]%}'
(( count = $count + 1 ))
done
PR_NO_COLOUR="%{$terminfo[sgr0]%}"
###
# See if we can use extended characters to look nicer.
typeset -A altchar
# set -A altchar "${(s..)terminfo[acsc]}"
PR_SET_CHARSET="%{$terminfo[enacs]%}"
PR_HBAR=${altchar[q]:--}
PR_ULCORNER=${altchar[l]:--}
PR_LLCORNER=${altchar[m]:--}
PR_LRCORNER=${altchar[j]:--}
PR_URCORNER=${altchar[k]:--}
###
# Modify Git prompt
ZSH_THEME_GIT_PROMPT_PREFIX=" ["
ZSH_THEME_GIT_PROMPT_SUFFIX="]"
###
# Modify RVM prompt
ZSH_THEME_RVM_PROMPT_PREFIX=" ["
ZSH_THEME_RVM_PROMPT_SUFFIX="]"
###
# Decide if we need to set titlebar text.
case $TERM in
xterm*|*rxvt*)
PR_TITLEBAR=$'%{\e]0;%(!.-=*[ROOT]*=- | .)%n@%M:%~ $(git_prompt_info) $(rvm_prompt_info) | ${COLUMNS}x${LINES} | %y\a%}'
;;
screen)
PR_TITLEBAR=$'%{\e_screen \005 (\005t) | %(!.-=[ROOT]=- | .)%n@%m:%~ | ${COLUMNS}x${LINES} | %y\e\\%}'
;;
*)
PR_TITLEBAR=''
;;
esac
###
# Decide whether to set a screen title
if [[ "$TERM" == "screen" ]]; then
PR_STITLE=$'%{\ekzsh\e\\%}'
else
PR_STITLE=''
fi
###
# Finally, the prompt.
#
PROMPT='$PR_SET_CHARSET$PR_STITLE${(e)PR_TITLEBAR}\
$PR_RED$PR_HBAR<\
$PR_BLUE%(!.$PR_RED%SROOT%s.%n)$PR_GREEN@$PR_BLUE%M:$PR_GREEN%$PR_PWDLEN<...<%~$PR_CYAN$(git_prompt_info)$(rvm_prompt_info)\
$PR_RED>$PR_HBAR$PR_SPACE${(e)PR_FILLBAR}\
$PR_RED$PR_HBAR<\
$PR_GREEN%l$PR_RED>$PR_HBAR\
$PR_RED$PR_HBAR<\
%(?..$PR_LIGHT_RED%?$PR_BLUE:)\
$PR_LIGHT_BLUE%(!.$PR_RED.$PR_WHITE)%#$PR_RED>$PR_HBAR\
$PR_NO_COLOUR '
}
setprompt
ZSH_THEME_GIT_PROMPT_PREFIX=" %{$fg[green]%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_DIRTY=" %{$fg[red]%}⚡"
ZSH_THEME_GIT_PROMPT_CLEAN=""
function prompt_char {
if [ $UID -eq 0 ]; then echo "%{$fg[red]%}#%{$reset_color%}"; else echo $; fi
}
PROMPT='%(?,,%{$fg[red]%}FAIL: $?%{$reset_color%}
)%{$fg[magenta]%}%n%{$reset_color%}@%{$fg[yellow]%}%m%{$reset_color%}: %{$fg_bold[blue]%}%~%{$reset_color%}$(git_prompt_info) %_$(prompt_char) '
RPROMPT='%{$fg[green]%}[%*]%{$reset_color%}'
......@@ -14,6 +14,12 @@ function _upgrade_zsh() {
_update_zsh_update
}
epoch_target=$UPDATE_ZSH_DAYS
if [[ -z "$epoch_target" ]]; then
# Default to old behavior
epoch_target=13
fi
if [ -f ~/.zsh-update ]
then
. ~/.zsh-update
......@@ -23,7 +29,7 @@ then
fi
epoch_diff=$(($(_current_epoch) - $LAST_EPOCH))
if [ $epoch_diff -gt 13 ]
if [ $epoch_diff -gt $epoch_target ]
then
if [ "$DISABLE_UPDATE_PROMPT" = "true" ]
then
......@@ -32,9 +38,10 @@ then
echo "[Oh My Zsh] Would you like to check for updates?"
echo "Type Y to update oh-my-zsh: \c"
read line
if [ "$line" = Y ] || [ "$line" = y ]
then
if [ "$line" = Y ] || [ "$line" = y ]; then
_upgrade_zsh
else
_update_zsh_update
fi
fi
fi
......
......@@ -13,9 +13,8 @@ hash git >/dev/null && /usr/bin/env git clone https://github.com/robbyrussell/oh
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";
cp ~/.zshrc ~/.zshrc.pre-oh-my-zsh;
rm ~/.zshrc;
echo "\033[0;33mFound ~/.zshrc.\033[0m \033[0;32mBacking up to ~/.zshrc.pre-oh-my-zsh\033[0m";
mv ~/.zshrc ~/.zshrc.pre-oh-my-zsh;
fi
echo "\033[0;34mUsing the Oh My Zsh template file and adding it to ~/.zshrc\033[0m"
......
......@@ -4,12 +4,20 @@ then
rm -rf ~/.oh-my-zsh
fi
echo "Looking for an existing zsh config..."
echo "Looking for original zsh config..."
if [ -f ~/.zshrc.pre-oh-my-zsh ] || [ -h ~/.zshrc.pre-oh-my-zsh ]
then
echo "Found ~/.zshrc. Backing up to ~/.zshrc.pre-oh-my-zsh";
rm ~/.zshrc;
cp ~/.zshrc.pre-oh-my-zsh ~/.zshrc;
echo "Found ~/.zshrc.pre-oh-my-zsh -- Restoring to ~/.zshrc";
if [ -f ~/.zshrc ] || [ -h ~/.zshrc ]
then
ZSHRC_SAVE=".zshrc.omz-uninstalled-`date +%Y%m%d%H%M%S`";
echo "Found ~/.zshrc -- Renaming to ~/${ZSHRC_SAVE}";
mv ~/.zshrc ~/${ZSHRC_SAVE};
fi
mv ~/.zshrc.pre-oh-my-zsh ~/.zshrc;
source ~/.zshrc;
else
echo "Switching back to bash"
......@@ -17,4 +25,4 @@ else
source /etc/profile
fi
echo "Thanks for trying out Oh My Zsh. It's been uninstalled."
\ No newline at end of file
echo "Thanks for trying out Oh My Zsh. It's been uninstalled."
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment