3 ### Bash session things.
7 ## Only do this if we haven't done it before. (Note that this guard isn't
8 ## exported, so subshells will need to make their own arrangements.)
9 case ${__mdw_bashrc+t} in
13 ###--------------------------------------------------------------------------
14 ### Hook implementation.
16 __mdw_precmd_hook= __mdw_preexec_hook=
19 __mdw_run_precmd_hook () {
20 __mdw_runhook __mdw_precmd_hook "$@"
23 __mdw_run_preexec_hook () {
24 case $__mdw_running in
28 set -- $(history 1); shift
29 __mdw_runhook __mdw_preexec_hook "$*"
34 PROMPT_COMMAND=__mdw_run_precmd_hook
35 trap __mdw_run_preexec_hook DEBUG
37 ###--------------------------------------------------------------------------
38 ### Common shell configuration.
42 ###--------------------------------------------------------------------------
43 ### Other preliminaries.
45 ## If we've not run the main profile yet, we should do that first. It sets
46 ## up things we rely on. Also, if there's a system script, we should run
48 case ${__mdw_profile+t} in t) ;; *) . "$HOME/.profile" ;; esac
49 __mdw_source_if_exists /etc/bashrc
52 __mdw_source_if_exists /etc/bash_completion "$HOME/.bash_completion"
54 ###--------------------------------------------------------------------------
57 __mdw_set_prompt_hacks () {
59 linux*|screen*|xterm*|putty*|vt100*|eterm*)
60 case "$(tput bold)" in
61 "") bold="\[$(tput md)\]" unbold="\[$(tput me)\]" ;;
62 *) bold="\[$(tput bold)\]" unbold="\[$(tput sgr0)\]" ;;
64 gitcolour="\[$(tput setaf 6)\]"
65 rccolour="\[$(tput setaf 1)\]"
66 uncolour="\[$(tput op)\]"
73 ## Only bother if the shell is interactive.
76 __mdw_source_if_exists /usr/lib/git-core/git-sh-prompt
77 __mdw_set_prompt_pieces
80 ###--------------------------------------------------------------------------
81 ### Other shell tweaking.
83 ## Random shell tweaks.
92 shopt -s expand_aliases
94 if (( ${BASH_VERSINFO[0]} >= 4 )); then shopt -s globstar; fi
100 shopt -s hostcomplete
102 shopt -s interactive_comments
108 shopt -u shift_verbose
110 HISTCONTROL=ignorespace:erasedups
112 ###--------------------------------------------------------------------------
113 ### Finishing touches.
115 ## Run any local hooks.
116 __mdw_source_if_exists "$HOME/.bashrc-local"
118 ###----- That's all, folks --------------------------------------------------