dot/gpg.conf.m4, dot/gpg-agent.conf, Makefile: Adopt GnuPG configuration.
[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 extracolour="\[$(tput setaf 3)\]"
66 rccolour="\[$(tput setaf 1)\]"
67 uncolour="\[$(tput op)\]"
68 nl="\[\r\]"
69 ;;
70 esac
71 host='\h' dir=' \w'
72}
73
74## Only bother if the shell is interactive.
75if [ -t 0 ]; then
76 PROMPT_DIRTRIM=5
77 __mdw_source_if_exists /usr/lib/git-core/git-sh-prompt
78 __mdw_set_prompt_pieces
79fi
80
81###--------------------------------------------------------------------------
82### Other shell tweaking.
83
84## Random shell tweaks.
85notify=1
86set -b
87shopt -u cdable_vars
88shopt -s cdspell
89shopt -s checkhash
90shopt -s checkwinsize
91shopt -s cmdhist
92shopt -u dotglob
93shopt -s expand_aliases
94shopt -s extglob
95if (( ${BASH_VERSINFO[0]} >= 4 )); then shopt -s globstar; fi
96shopt -s gnu_errfmt
97shopt -s histappend
98set -o histexpand
99shopt -s histreedit
100shopt -u histverify
101shopt -s hostcomplete
102shopt -s huponexit
103shopt -s interactive_comments
104shopt -s lithist
105shopt -u mailwarn
106shopt -u nocaseglob
107shopt -u nullglob
108shopt -s promptvars
109shopt -u shift_verbose
110shopt -s sourcepath
111HISTCONTROL=ignorespace:erasedups
112
113###--------------------------------------------------------------------------
114### Finishing touches.
115
116## Run any local hooks.
117__mdw_source_if_exists "$HOME/.bashrc-local"
118
119###----- That's all, folks --------------------------------------------------
120
121esac