dot/zshrc: Write numbers in odd bases using C notation.
[profile] / dot / bashrc
CommitLineData
ca7933c9 1### -*-bash-*-
59c9c0e4 2###
74a53e28
MW
3### Bash session things.
4
5__mdw_shell=bash
f617db13 6
59c9c0e4
MW
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.)
e849519a 9case ${__mdw_bashrc+t} in
74a53e28 10 t) ;;
e849519a 11 *) __mdw_bashrc=t
74a53e28 12
3b41df91
MW
13###--------------------------------------------------------------------------
14### Common shell configuration.
15
74a53e28 16. "$HOME/.shell-rc"
f617db13 17
3b41df91
MW
18###--------------------------------------------------------------------------
19### Other preliminaries.
20
59c9c0e4
MW
21## If we've not run the main profile yet, we should do that first. It sets
22## up things we rely on. Also, if there's a system script, we should run
23## that too.
74a53e28
MW
24case ${__mdw_profile+t} in t) ;; *) . "$HOME/.profile" ;; esac
25__mdw_source_if_exists /etc/bashrc
f617db13 26
5e662c38 27## Completion.
74a53e28 28__mdw_source_if_exists /etc/bash_completion "$HOME/.bash_completion"
5e662c38 29
59c9c0e4
MW
30###--------------------------------------------------------------------------
31### Prompt hacking.
f617db13 32
74a53e28 33__mdw_set_prompt_hacks () {
15b95c26 34 case "$TERM" in
8a075bd7 35 linux*|screen*|xterm*|putty*|vt100*|eterm*)
59c3438f
MW
36 case "$(tput bold)" in
37 "") bold="\[$(tput md)\]" unbold="\[$(tput me)\]" ;;
38 *) bold="\[$(tput bold)\]" unbold="\[$(tput sgr0)\]" ;;
39 esac
1273afa0 40 gitcolour="\[$(tput setaf 6)\]"
f00ae4fa
MW
41 rccolour="\[$(tput setaf 1)\]"
42 uncolour="\[$(tput op)\]"
9bd5ab69 43 nl="\[\r\]"
59c3438f 44 ;;
15b95c26 45 esac
74a53e28
MW
46 host='\h' dir=' \w'
47}
15b95c26 48
74a53e28
MW
49__mdw_before_cmd_hack () {
50 set -- $(history 1); shift
51 __mdw_preexec "$*"
52}
e04a3368 53
74a53e28
MW
54## Only bother if the shell is interactive.
55if [ -t 0 ]; then
56 PROMPT_DIRTRIM=5
57 __mdw_source_if_exists /usr/lib/git-core/git-sh-prompt
58 __mdw_set_prompt_pieces
59 PROMPT_COMMAND=__mdw_precmd
60 PS0="\$(__mdw_before_cmd_hack)"
59c9c0e4 61fi
15b95c26 62
59c9c0e4
MW
63###--------------------------------------------------------------------------
64### Other shell tweaking.
f617db13 65
59c9c0e4 66## Random shell tweaks.
f617db13
MW
67notify=1
68set -b
69shopt -u cdable_vars
70shopt -s cdspell
71shopt -s checkhash
72shopt -s checkwinsize
73shopt -s cmdhist
74shopt -u dotglob
75shopt -s expand_aliases
76shopt -s extglob
08404785 77if (( ${BASH_VERSINFO[0]} >= 4 )); then shopt -s globstar; fi
83a3b1eb 78shopt -s gnu_errfmt
f617db13 79shopt -s histappend
92e4caa8 80set -o histexpand
f617db13
MW
81shopt -s histreedit
82shopt -u histverify
83shopt -s hostcomplete
84shopt -s huponexit
85shopt -s interactive_comments
86shopt -s lithist
87shopt -u mailwarn
88shopt -u nocaseglob
89shopt -u nullglob
90shopt -s promptvars
91shopt -u shift_verbose
92shopt -s sourcepath
83a3b1eb
MW
93HISTCONTROL=ignorespace:erasedups
94
59c9c0e4
MW
95###--------------------------------------------------------------------------
96### Finishing touches.
f617db13 97
59c9c0e4 98## Run any local hooks.
74a53e28 99__mdw_source_if_exists "$HOME/.bashrc-local"
59c9c0e4
MW
100
101###----- That's all, folks --------------------------------------------------
0d9bb87e 102
74a53e28 103esac