[zshrc] Fix virtualenv prompt and git colors

This commit is contained in:
lhark 2018-07-10 15:35:05 -04:00
parent 7f2abdcdad
commit 8e1476e7b3
2 changed files with 9 additions and 6 deletions

10
prompt
View file

@ -43,10 +43,10 @@ last_status () {
}
virtual_env() {
local prefix=" %{$fg_bold[green]%}(%{%b$fg[green]%}"
local prefix="%{$fg_bold[green]%}(%{%b$fg[green]%}"
local suffix="%{$reset_color$fg_bold[green]%})%{$reset_color%}"
[[ -n ${VIRTUAL_ENV} ]] || return
printf "${prefix}${VIRTUAL_ENV:t}${suffix}"
printf '%s' "${prefix}${VIRTUAL_ENV:t}${suffix}"
}
prompt_chars() {
@ -54,7 +54,7 @@ prompt_chars() {
if $(git rev-parse --is-inside-work-tree >/dev/null 2>&1); then
local git_char="%{$fg_no_bold[blue]%}±%{$reset_color%}"
fi
printf "%s" "${_GIT_CHAR}$(last_status) $(color_prompt_char)"
printf '%s' "${_GIT_CHAR}$(last_status) $(color_prompt_char)"
}
charge_batterie() {
@ -102,8 +102,8 @@ prompt_msg () {
git_network_unreachable)
msg="Can't reach rc git repo";;
update_sys*)
nb_pkg=$(printf "$line" | grep -o '[0-9]*' | head -n 1)
msg="Update ready for the system. $nb_pkg new package$([ $nb_pkg -gt 1 ] && printf "s")";;
nb_pkg=$(printf '%s' "$line" | grep -o '[0-9]*' | head -n 1)
msg="Update ready for the system. $nb_pkg new package$([ $nb_pkg -gt 1 ] && printf 's')";;
*)
msg="";;
esac

5
zshrc
View file

@ -34,6 +34,9 @@ export PKG_CONFIG_PATH="/opt/ros/indigo/lib/pkgconfig:$PKG_CONFIG_PATH"
RC_PATH=$(dirname "$(readlink -f ${(%):-%x})")
# Import utility functions
# Colors needed for the prompt definition
autoload -U colors
colors
. "$RC_PATH/functions"
. "$RC_PATH/aliases"
. "$RC_PATH/prompt"
@ -140,7 +143,7 @@ zstyle ':completion:*' cache-path ~/.zs
######################
zmodload zsh/complist
autoload -U compinit promptinit colors
autoload -U compinit promptinit
compinit
colors
autoload -U zsh-mime-setup