Added the return code

This commit is contained in:
arcan1s
2014-01-10 17:38:26 +04:00
parent 4ec0b34351
commit bc3dc0e994

23
zshrc
View File

@ -1,5 +1,5 @@
# history # history
HISTFILE=~/.histfile HISTFILE=~/.zsh_history
HISTSIZE=500000 HISTSIZE=500000
SAVEHIST=500000 SAVEHIST=500000
@ -119,7 +119,7 @@ else
%{$fg_bold[white]%}]$ %{$reset_color%}" %{$fg_bold[white]%}]$ %{$reset_color%}"
fi fi
precmd () { precmd () {
# Battery charge # battery charge
function batcharge { function batcharge {
bat_perc=`acpi | awk {'print $4;'} | sed -e "s/\s//" -e "s/%.*//"` bat_perc=`acpi | awk {'print $4;'} | sed -e "s/\s//" -e "s/%.*//"`
@ -133,16 +133,15 @@ precmd () {
echo "%{$fg_bold[white]%}["$col$bat_perc"%{$fg_bold[white]%}%%]%{$reset_color%}" echo "%{$fg_bold[white]%}["$col$bat_perc"%{$fg_bold[white]%}%%]%{$reset_color%}"
} }
# last command
returncode="%(?.%{$fg[green]%}.%{$fg[red]%})%?%{$resetcolor%}"
RPROMPT="%{$fg_bold[white]%}[%{$reset_color%}\ RPROMPT="%{$fg_bold[white]%}[%{$reset_color%}\
%{$fg_bold[cyan]%}%T%{$reset_color%}\ %{$fg_bold[cyan]%}%T%{$reset_color%}\
%{$fg_bold[white]%}]%{$reset_color%}"\ %{$fg_bold[white]%}]%{$reset_color%}"\
$(batcharge) $(batcharge)\
# if [[ $EUID == 0 ]] "%{$fg_bold[white]%}[%{$reset_color%}"\
# then $returncode\
# PROMPT=$'%{\e[1;37m%}# %{\e[1;31m%}%n %{\e[1;37m%}at %{\e[0;31m%}%m %{\e[1;37m%}in %{\e[1;33m%}%~ %{\e[1;37m%}[%D] [%*] '$(batcharge)$'%{\e[1;37m%} [%?]\n%{\e[1;31m%}# %{\e[0m%}' "%{$fg_bold[white]%}]%{$reset_color%}"
# else
# PROMPT=$'%{\e[1;37m%}# %{\e[1;32m%}%n %{\e[1;37m%}at %{\e[0;32m%}%m %{\e[1;37m%}in %{\e[1;33m%}%~ %{\e[1;37m%}[%D] [%*] '$(batcharge)$'%{\e[1;37m%} [%?]\n%{\e[1;32m%}$ %{\e[0m%}'
# fi
} }
# right prompt with time # right prompt with time
#RPROMPT=$'%{\e[1;37m%}%T, %D%{\e[0m%}' #RPROMPT=$'%{\e[1;37m%}%T, %D%{\e[0m%}'
@ -165,9 +164,9 @@ alias rm='show_which rm && rm -I'
su () { su () {
checksu=0 checksu=0
for flags in $*; do for flags in $*; do
if [[ $flags == "-" ]]; then [[ $flags == "-" ]] && checksu=1
checksu=1 [[ $flags == "-l" ]] && checksu=1
fi [[ $flags == "--login" ]] && checksu=1
done done
if [[ $checksu == 0 ]]; then if [[ $checksu == 0 ]]; then
echo "Use 'su -', Luke" echo "Use 'su -', Luke"