dot/vm: Configure displaying messages as threads.
[profile] / dot / bashrc
... / ...
CommitLineData
1### -*-bash-*-
2###
3### Bash session things.
4
5__mdw_shell=bash
6
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.)
9case ${__mdw_bashrc+t} in
10 t) ;;
11 *) __mdw_bashrc=t
12
13###--------------------------------------------------------------------------
14### Hook implementation.
15
16__mdw_precmd_hook= __mdw_preexec_hook=
17__mdw_running=t
18
19__mdw_run_precmd_hook () {
20 __mdw_runhook __mdw_precmd_hook "$@"
21 __mdw_running=nil
22}
23__mdw_run_preexec_hook () {
24 case $__mdw_running in
25 t) ;;
26 nil)
27 __mdw_running=t;
28 set -- $(history 1); shift
29 __mdw_runhook __mdw_preexec_hook "$*"
30 ;;
31 esac
32}
33
34PROMPT_COMMAND=__mdw_run_precmd_hook
35trap __mdw_run_preexec_hook DEBUG
36
37###--------------------------------------------------------------------------
38### Common shell configuration.
39
40. "$HOME/.shell-rc"
41
42###--------------------------------------------------------------------------
43### Other preliminaries.
44
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
47## that too.
48case ${__mdw_profile+t} in t) ;; *) . "$HOME/.profile" ;; esac
49__mdw_source_if_exists /etc/bashrc
50
51## Completion.
52__mdw_source_if_exists /etc/bash_completion "$HOME/.bash_completion"
53
54###--------------------------------------------------------------------------
55### Prompt hacking.
56
57__mdw_set_prompt_hacks () {
58 case "$TERM" in
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)\]" ;;
63 esac
64 gitcolour="\[$(tput setaf 6)\]"
65 rccolour="\[$(tput setaf 1)\]"
66 uncolour="\[$(tput op)\]"
67 nl="\[\r\]"
68 ;;
69 esac
70 host='\h' dir=' \w'
71}
72
73## Only bother if the shell is interactive.
74if [ -t 0 ]; then
75 PROMPT_DIRTRIM=5
76 __mdw_source_if_exists /usr/lib/git-core/git-sh-prompt
77 __mdw_set_prompt_pieces
78fi
79
80###--------------------------------------------------------------------------
81### Other shell tweaking.
82
83## Random shell tweaks.
84notify=1
85set -b
86shopt -u cdable_vars
87shopt -s cdspell
88shopt -s checkhash
89shopt -s checkwinsize
90shopt -s cmdhist
91shopt -u dotglob
92shopt -s expand_aliases
93shopt -s extglob
94if (( ${BASH_VERSINFO[0]} >= 4 )); then shopt -s globstar; fi
95shopt -s gnu_errfmt
96shopt -s histappend
97set -o histexpand
98shopt -s histreedit
99shopt -u histverify
100shopt -s hostcomplete
101shopt -s huponexit
102shopt -s interactive_comments
103shopt -s lithist
104shopt -u mailwarn
105shopt -u nocaseglob
106shopt -u nullglob
107shopt -s promptvars
108shopt -u shift_verbose
109shopt -s sourcepath
110HISTCONTROL=ignorespace:erasedups
111
112###--------------------------------------------------------------------------
113### Finishing touches.
114
115## Run any local hooks.
116__mdw_source_if_exists "$HOME/.bashrc-local"
117
118###----- That's all, folks --------------------------------------------------
119
120esac