X-Git-Url: https://git.distorted.org.uk/~mdw/profile/blobdiff_plain/d90fb8419fd562d9e496a39cb37fa8b96b9f5ef7..48a9c9c1a60f4f5ebc71a5e5269b01109c9dcfa4:/dot/zshrc?ds=sidebyside diff --git a/dot/zshrc b/dot/zshrc index c6cfa99..e02aaa7 100644 --- a/dot/zshrc +++ b/dot/zshrc @@ -3,7 +3,6 @@ ### Zsh session things. __mdw_shell=zsh -case ${INSIDE_EMACS+t},$TERM in t,dumb) unsetopt zle ;; esac ###-------------------------------------------------------------------------- ### History settings. @@ -15,10 +14,32 @@ HISTSIZE=1000 SAVEHIST=1000 ###-------------------------------------------------------------------------- +### Hook implementation. + +__mdw_precmd_hook= __mdw_preexec_hook= + +__mdw_run_precmd_hook () { __mdw_runhook __mdw_precmd_hook; } +__mdw_run_preexec_hook () { __mdw_runhook __mdw_preexec_hook "$2"; } + +precmd_functions+=(__mdw_run_precmd_hook) +preexec_functions+=(__mdw_run_preexec_hook) + +###-------------------------------------------------------------------------- ### Common shell configuration. . "$HOME/.shell-rc" +## Fixup: `zsh' has sane quoting rules. +__mdw_runhook () { + local hk=$1 saverc=$? t i; shift + + eval t=\${$hk+t} + case $t in t) ;; *) echo >&2 "unknown hook \`$hk'"; return 2; esac + + eval t=\$$hk + for i in ${=t}; do __mdw_setrc $saverc; "$i" "$@"; done +} + ###-------------------------------------------------------------------------- ### Prompt hacking. @@ -26,7 +47,7 @@ __mdw_set_prompt_hacks () { case $TERM in linux*|screen*|xterm*|putty*|vt100*|eterm*) bold=%B unbold=%b - gitcolour=%F{cyan} rccolour=%F{red} uncolour=%f + gitcolour=%F{cyan} extracolour=%F{yellow} rccolour=%F{red} uncolour=%f ;; esac host=%m dir=" %(6~!%-1~/.../%4~!%~)" @@ -36,14 +57,13 @@ __mdw_set_prompt_hacks () { if [ -t 0 ]; then __mdw_source_if_exists /usr/lib/git-core/git-sh-prompt __mdw_set_prompt_pieces - precmd_functions+=(__mdw_precmd) - preexec_functions+=(__mdw_preexec) fi ###-------------------------------------------------------------------------- ### Line editing. -case $TERM in dumb) unsetopt zle ;; esac +case ${INSIDE_EMACS+t},$TERM in t,dumb) unsetopt zle ;; esac +case $TERM in dumb) unset zle_bracketed_paste ;; esac bindkey -e @@ -60,6 +80,7 @@ do zstyle ':zle:*-bash' word-chars "" zstyle ':zle:*-shell' word-style shell zstyle ':zle:*-shell' skip-whitespace-first false + zstyle ':completion:*' rehash true done bindkey "\eb" backward-word-bash @@ -160,10 +181,12 @@ unsetopt ksh_glob setopt list_ambiguous setopt list_packed setopt multios +setopt magic_equal_subst unsetopt nomatch unsetopt menu_complete setopt notify setopt rc_expand_param +setopt rc_quotes setopt share_history hash -d t=$TMPDIR