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