1
0
Fork 0

more color tweaks for bash prompt

This commit is contained in:
Von Random 2016-12-22 12:42:21 +03:00
parent 6e4f7a36d6
commit 4a31a22206
2 changed files with 17 additions and 15 deletions

View file

@ -28,14 +28,14 @@ enable_git_prompt()
GIT_PROMPT_SEPARATOR=" "
GIT_PROMPT_START="[ ${git_prompt_username}${HOSTNAME}:${pbold}\w${preset} ]"
GIT_PROMPT_THEME_NAME="Custom"
GIT_PROMPT_UNTRACKED="${pncyan}u"
GIT_PROMPT_CHANGED="${pnblue}+"
GIT_PROMPT_STAGED="${pnyellow}s"
GIT_PROMPT_CONFLICTS="${pnred}x"
GIT_PROMPT_STASHED="${pbmagenta}→"
GIT_PROMPT_CLEAN="${pngreen}."
GIT_PROMPT_UNTRACKED="${pcyan}u"
GIT_PROMPT_CHANGED="${pblue}+"
GIT_PROMPT_STAGED="${pyellow}s"
GIT_PROMPT_CONFLICTS="${pred}x"
GIT_PROMPT_STASHED="${ppurple}→"
GIT_PROMPT_CLEAN="${pgreen}."
GIT_PROMPT_END_USER="\n${pbold}>${preset} "
GIT_PROMPT_END_ROOT="\n${pnred}>${preset} "
GIT_PROMPT_END_ROOT="\n${pred}>${preset} "
. "${git_prompt_path}"
fi
}

18
bashrc
View file

@ -25,11 +25,13 @@ is_exec() { [[ -x $(type -P ${1}) ]]; }
# }}}
# {{{ prompt
color_number=0
for color in 'black' 'red' 'green' 'yellow' 'blue' 'magenta' 'cyan' 'white'; do
eval "pn${color}='\[\e[38;5;$((color_number))m\]'"
eval "pb${color}='\[\e[38;5;$((color_number+8))m\]'"
eval "n${color}='\e[38;5;$((color_number))m'"
eval "b${color}='\e[38;5;$((color_number+8))m'"
# colors are named for the solarized palette
for color in \
gray6 red green yellow blue magenta cyan gray1 \
black orange gray5 gray4 gray3 purple gray2 white
do
eval "p${color}='\[\e[38;5;${color_number}m\]'"
eval "${color}='\e[38;5;${color_number}m'"
(( color_number++ ))
done
unset color_number
@ -52,12 +54,12 @@ prompt_command()
if [[ ${USER} == 'von' ]]; then
prompt_user=""
else
prompt_user="${pnred}\u${preset} "
prompt_user="${pred}\u${preset} "
fi
if ((UID)); then
bang="${pbold}>"
else
bang="${pnred}>"
bang="${pred}>"
fi
PS1="[ ${prompt_user}${HOSTNAME}:${pbold}\w${preset} ]${newline}${bang}${preset} "
}
@ -149,5 +151,5 @@ plugins="${HOME}/.bashplugins"
[[ -r "${plugins}" ]] && . "${plugins}"
# we want to see exit code on error (it also has to be the last entry here)
trap 'printf "${nred}>>${reset} ${bold}exit${reset} ${nred}%s${reset}\n" "$?" >&2' ERR
trap 'printf "${nred}>>${reset} ${bold}exit${reset} ${red}%s${reset}\n" "$?" >&2' ERR
# }}}