__mdw_set_prompt_pieces () {
## Fancy highlighting in some terminals.
- local bold unbold nl gitcolour rccolour uncolour
- local host dir more
- bold="" unbold="" nl="" gitcolour="" rccolour="" uncolour="" more=""
+ local bold unbold nl more host dir
+ local gitcolour extracolour rccolour uncolour
+ bold="" unbold="" nl="" more=""
+ gitcolour="" extracolour="" rccolour="" uncolour=""
__mdw_set_prompt_hacks
## Choose the right delimiters. Highlight root prompts specially;
__mdw_prompt_git_right="$uncolour$bold"
__mdw_prompt_rc_left="$unbold$rccolour"
__mdw_prompt_rc_right="$uncolour$bold"
+ __mdw_prompt_extra_left="$unbold$extracolour"
+ __mdw_prompt_extra_right="$uncolour$bold"
__mdw_prompt_right="$right$unbold"
__mdw_prompt_more=" $more$bold>$unbold "
}
;;
*)
__mdw_last_rc=$?
- local git rc
+ local git extra rc
if type __git_ps1 >/dev/null 2>&1; then
git="$__mdw_prompt_git_left$(__git_ps1)$__mdw_prompt_git_right"
else
0) rc="" ;;
*) rc="$__mdw_prompt_rc_left rc=$__mdw_last_rc$__mdw_prompt_rc_right" ;;
esac
- PS1="$__mdw_prompt_left$git$rc$__mdw_prompt_right"
+ case $__mdw_prompt_extra in
+ ?*) extra="$__mdw_prompt_extra_left [$__mdw_prompt_extra]$__mdw_prompt_extra_right" ;;
+ *) extra="" ;;
+ esac
+ PS1="$__mdw_prompt_left$git$extra$rc$__mdw_prompt_right"
PS2="$PS1$__mdw_prompt_more"
unset __mdw_last_rc
;;
__mdw_xterm_settitle () {
printf >/dev/tty \
- "\e]2;%s@%s:%s – %s\e\\" \
+ "\e]0;%s@%s:%s – %s\e\\" \
"$__mdw_user" "$__mdw_host$__mdw_hqual" "$PWD" \
"$1"
}
alias cmucl="rlwrap cmucl -quiet"
alias ecl="rlwrap ecl"
alias sbcl="rlwrap sbcl --noinform"
+alias ccl="rlwrap ccl"
+alias ccl32="rlwrap ccl32"
+alias ccl64="rlwrap ccl64"
+alias abcl="rlwrap abcl --noinform"
###--------------------------------------------------------------------------
### Colour output.
-## Arrange for `ls' output to be in colour.
-if __mdw_programp dircolors; then eval $(dircolors -b "$HOME/.dircolors")
-else unset LS_COLORS; fi
+mdw_colour_p () {
+ if ! [ -t 1 ]; then return 1; fi
+ case $TERM in dumb) return 1 ;; esac
+ return 0
+}
+## Arrange for `ls' output to be in colour.
unalias ls 2>/dev/null || :
ls () {
- if [ -t 1 ]; then command ls $LS_OPTIONS ${LS_COLORS+--color=auto} "$@"
+ if mdw_colour_p; then command ls $LS_OPTIONS ${LS_COLORS+--color=always} "$@"
else command ls "$@"; fi
}
## Arrange for `grep' output to be in colour.
-export GREP_COLORS="mt=01;31:ms=01;31:mc=031;31:fn=36:ln=36:bn=36:se=34"
-
greplike () {
local grep=$1; shift
- if [ -t 1 ]; then
+ if mdw_colour_p; then
command $grep ${GREP_COLORS+--color=always} "$@" | mdw-pager
else
command $grep "$@"
alias zgrep="greplike zgrep"
## Arrange for `diff' output to be in colour.
-export DIFF_COLORS="hd=1:ln=36:ad=32:de=31"
difflike () {
local diff=$1; shift
- if [ -t 1 ]; then
+ if mdw_colour_p; then
command $diff \
${DIFF_COLORS+--color=always} \
${DIFF_COLORS+--palette="$DIFF_COLORS"} \
;;
esac
+## Install wakeup machinery for long-running programs.
+case ${DISPLAY+t},${WINDOWID+t},${__mdw_precmd_hook+t},${__mdw_preexec_hook+t} in
+ t,t,t,t)
+ if [ -t 0 ] && __mdw_programp notify-send; then . $HOME/bin/wakey.sh; fi
+ ;;
+esac
+
## Run any local hooks.
__mdw_source_if_exists "$HOME/.shell-local"