chiark / gitweb /
dot/zprofile, dot/zshrc: Configuration for Zsh.
[profile] / dot / zshrc
CommitLineData
a797cf50
MW
1### -*-sh-*-
2###
3### Zsh session things.
4
5__mdw_shell=zsh
6case ${INSIDE_EMACS+t},$TERM in t,dumb) unsetopt zle ;; esac
7
8. "$HOME/.shell-rc"
9
10###--------------------------------------------------------------------------
11### Prompt hacking.
12
13__mdw_set_prompt_hacks () {
14 case $TERM in
15 linux*|screen*|xterm*|vt100*|eterm*)
16 bold=%B unbold=%b
17 gitcolour=%F{cyan} rccolour=%F{red} uncolour=%f
18 ;;
19 esac
20 host=%m dir=" %(6~!%-1~/.../%5~!%~)"
21}
22
23if [ -t 0 ]; then
24 __mdw_source_if_exists /usr/lib/git-core/git-sh-prompt
25 __mdw_set_prompt_pieces
26 precmd_functions+=(__mdw_precmd)
27 preexec_functions+=(__mdw_preexec)
28fi
29
30###--------------------------------------------------------------------------
31### Line editing.
32
33autoload -U select-word-style
34select-word-style bash
35bindkey -e
36
37###--------------------------------------------------------------------------
38### Completion.
39
40## Initialize the fancy completion machinery.
41autoload -Uz compinit
42compinit
43
44## Contexts: :completion:FUNCTION:COMPLETER:COMMAND:ARGUMENT:TAG
45zstyle ':completion:*' completer _expand _complete _ignored _approximate
46zstyle ':completion:*' insert-unambiguous false
47zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS}
48zstyle ':completion:*' list-prompt %SAt %p: Hit TAB for more, or the character to insert%s
49zstyle ':completion:*' matcher-list '' '+m:{[:lower:]}={[:upper:]} r:|[._-]=** r:|=**' '+l:|=* r:|=*'
50zstyle ':completion:*' max-errors 0 numeric
51zstyle ':completion:*' original true
52zstyle ':completion:*' verbose false
53zstyle ':completion:*:*:git*:*' verbose true
54
55_r () { words[1]=sudo; _normal; }
56compdef _r rootly
57compdef _ssh @
58
59###--------------------------------------------------------------------------
60### Other shell tweaking.
61
62HISTFILE=~/.zsh-history
63HISTSIZE=1000
64SAVEHIST=1000
65
66setopt appendhistory
67unsetopt auto_cd
68unsetopt auto_menu
69unsetopt bash_auto_list
70unsetopt beep
71setopt extendedglob
72setopt ksh_glob
73setopt list_ambiguous
74setopt list_packed
75unsetopt nomatch
76unsetopt menu_complete
77setopt notify
78
79zshaddhistory () {
80 case "$1" in
81 " "*) return 2 ;;
82 *) return 0 ;;
83 esac
84}
85
86###--------------------------------------------------------------------------
87### Finishing touches.
88
89__mdw_source_if_exists "$HOME/.zshrc-local"
90
91###----- That's all, folks --------------------------------------------------