dot/zshrc: `delete-horizontal-space' (M-\) and `just-one-space' (M-SPC).
[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.)
74a53e28
MW
9case ${__mdw_shellrc+t} in
10 t) ;;
11 *) __mdw_shellrc=done
12
13## Fetch the common configuration.
14. "$HOME/.shell-rc"
f617db13 15
59c9c0e4
MW
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.
74a53e28
MW
19case ${__mdw_profile+t} in t) ;; *) . "$HOME/.profile" ;; esac
20__mdw_source_if_exists /etc/bashrc
f617db13 21
5e662c38 22## Completion.
74a53e28 23__mdw_source_if_exists /etc/bash_completion "$HOME/.bash_completion"
5e662c38 24
59c9c0e4
MW
25## Set the temporary directory again. (If we've switched users, we'll want a
26## different temporary directory.)
74a53e28 27case ${TMPDIR+t} in t) ;; *) eval $(tmpdir -b); esac
59c9c0e4
MW
28
29###--------------------------------------------------------------------------
30### Prompt hacking.
f617db13 31
74a53e28 32__mdw_set_prompt_hacks () {
15b95c26
MW
33 case "$TERM" in
34 linux*|screen*|xterm*|vt100*|eterm*)
59c3438f
MW
35 case "$(tput bold)" in
36 "") bold="\[$(tput md)\]" unbold="\[$(tput me)\]" ;;
37 *) bold="\[$(tput bold)\]" unbold="\[$(tput sgr0)\]" ;;
38 esac
1273afa0 39 gitcolour="\[$(tput setaf 6)\]"
f00ae4fa
MW
40 rccolour="\[$(tput setaf 1)\]"
41 uncolour="\[$(tput op)\]"
59c3438f
MW
42 nl="\[\r\]"
43 ;;
15b95c26 44 esac
74a53e28
MW
45 host='\h' dir=' \w'
46}
15b95c26 47
74a53e28
MW
48__mdw_before_cmd_hack () {
49 set -- $(history 1); shift
50 __mdw_preexec "$*"
51}
e04a3368 52
74a53e28
MW
53## Only bother if the shell is interactive.
54if [ -t 0 ]; then
55 PROMPT_DIRTRIM=5
56 __mdw_source_if_exists /usr/lib/git-core/git-sh-prompt
57 __mdw_set_prompt_pieces
58 PROMPT_COMMAND=__mdw_precmd
59 PS0="\$(__mdw_before_cmd_hack)"
59c9c0e4 60fi
15b95c26 61
59c9c0e4
MW
62###--------------------------------------------------------------------------
63### Other shell tweaking.
f617db13 64
59c9c0e4 65## Random shell tweaks.
f617db13
MW
66notify=1
67set -b
68shopt -u cdable_vars
69shopt -s cdspell
70shopt -s checkhash
71shopt -s checkwinsize
72shopt -s cmdhist
73shopt -u dotglob
74shopt -s expand_aliases
75shopt -s extglob
08404785 76if (( ${BASH_VERSINFO[0]} >= 4 )); then shopt -s globstar; fi
83a3b1eb 77shopt -s gnu_errfmt
f617db13
MW
78shopt -s histappend
79shopt -s histreedit
80shopt -u histverify
81shopt -s hostcomplete
82shopt -s huponexit
83shopt -s interactive_comments
84shopt -s lithist
85shopt -u mailwarn
86shopt -u nocaseglob
87shopt -u nullglob
88shopt -s promptvars
89shopt -u shift_verbose
90shopt -s sourcepath
83a3b1eb
MW
91HISTCONTROL=ignorespace:erasedups
92
59c9c0e4
MW
93###--------------------------------------------------------------------------
94### Finishing touches.
f617db13 95
59c9c0e4 96## Run any local hooks.
74a53e28 97__mdw_source_if_exists "$HOME/.bashrc-local"
59c9c0e4
MW
98
99###----- That's all, folks --------------------------------------------------
0d9bb87e 100
74a53e28 101esac