git prompt is back as well as a proper trap
This commit is contained in:
parent
36839c9cd5
commit
d1440f2cc1
1 changed files with 14 additions and 10 deletions
24
bashrc
24
bashrc
|
@ -12,7 +12,7 @@ unset local_bin vscripts gem_bin
|
||||||
|
|
||||||
dotfiles="${HOME}/vdotfiles"
|
dotfiles="${HOME}/vdotfiles"
|
||||||
#comp_enabled=true
|
#comp_enabled=true
|
||||||
#git_enabled=true
|
git_enabled=true
|
||||||
|
|
||||||
HISTSIZE=1000
|
HISTSIZE=1000
|
||||||
HISTFILE="${HOME}/.bash_history.${UID}"
|
HISTFILE="${HOME}/.bash_history.${UID}"
|
||||||
|
@ -35,13 +35,17 @@ is_exec() { [[ -x $(type -P ${1}) ]]; }
|
||||||
# {{{ prompt
|
# {{{ prompt
|
||||||
color_number=0
|
color_number=0
|
||||||
for color in 'black' 'red' 'green' 'yellow' 'blue' 'magenta' 'cyan' 'white'; do
|
for color in 'black' 'red' 'green' 'yellow' 'blue' 'magenta' 'cyan' 'white'; do
|
||||||
eval "n${color}='\[\e[0;3${color_number}m\]'"
|
eval "pn${color}='\[\e[0;3${color_number}m\]'"
|
||||||
eval "b${color}='\[\e[1;3${color_number}m\]'"
|
eval "pb${color}='\[\e[1;3${color_number}m\]'"
|
||||||
|
eval "n${color}='\e[0;3${color_number}m'"
|
||||||
|
eval "b${color}='\e[1;3${color_number}m'"
|
||||||
(( color_number++ ))
|
(( color_number++ ))
|
||||||
done
|
done
|
||||||
unset color_number
|
unset color_number
|
||||||
reset='\[\e[0m\]'
|
preset='\[\e[0m\]'
|
||||||
bold='\[\e[1m\]'
|
pbold='\[\e[1m\]'
|
||||||
|
reset='\e[0m'
|
||||||
|
bold='\e[1m'
|
||||||
newline='
|
newline='
|
||||||
'
|
'
|
||||||
prompt_command()
|
prompt_command()
|
||||||
|
@ -57,14 +61,14 @@ prompt_command()
|
||||||
if [[ ${USER} == 'von' ]]; then
|
if [[ ${USER} == 'von' ]]; then
|
||||||
prompt_user=""
|
prompt_user=""
|
||||||
else
|
else
|
||||||
prompt_user="${nred}\u${reset} "
|
prompt_user="${pnred}\u${preset} "
|
||||||
fi
|
fi
|
||||||
if [[ $UID -eq 0 ]]; then
|
if [[ $UID -eq 0 ]]; then
|
||||||
color_bang="${nred}"
|
color_bang="${pnred}"
|
||||||
else
|
else
|
||||||
color_bang="${bold}"
|
color_bang="${pbold}"
|
||||||
fi
|
fi
|
||||||
PS1="[ ${prompt_user}${HOSTNAME}:${bold}\w${reset} ]${newline}${color_bang}>${reset} "
|
PS1="[ ${prompt_user}${HOSTNAME}:${pbold}\w${preset} ]${newline}${color_bang}>${preset} "
|
||||||
}
|
}
|
||||||
PROMPT_COMMAND=prompt_command
|
PROMPT_COMMAND=prompt_command
|
||||||
# }}}
|
# }}}
|
||||||
|
@ -159,5 +163,5 @@ unset completion_path git_prompt_path
|
||||||
# }}}
|
# }}}
|
||||||
# {{{ traps
|
# {{{ traps
|
||||||
# we want to see exit code on error (it also has to be the last entry here)
|
# we want to see exit code on error (it also has to be the last entry here)
|
||||||
trap 'printf "\e[0m>> exit \e[1;37m%s\e[0m\n" $?' ERR
|
trap 'printf "${nred}>>${reset} ${bold}exit${reset} ${nred}%s${reset}\n" "$?"' ERR
|
||||||
# }}}
|
# }}}
|
||||||
|
|
Loading…
Reference in a new issue