Commit | Line | Data |
---|---|---|
a797cf50 MW |
1 | ### -*-sh-*- |
2 | ### | |
3 | ### Zsh session things. | |
4 | ||
5 | __mdw_shell=zsh | |
6 | case ${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 | ||
23 | if [ -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) | |
28 | fi | |
29 | ||
30 | ###-------------------------------------------------------------------------- | |
31 | ### Line editing. | |
32 | ||
33 | autoload -U select-word-style | |
34 | select-word-style bash | |
35 | bindkey -e | |
36 | ||
37 | ###-------------------------------------------------------------------------- | |
38 | ### Completion. | |
39 | ||
40 | ## Initialize the fancy completion machinery. | |
41 | autoload -Uz compinit | |
42 | compinit | |
43 | ||
44 | ## Contexts: :completion:FUNCTION:COMPLETER:COMMAND:ARGUMENT:TAG | |
45 | zstyle ':completion:*' completer _expand _complete _ignored _approximate | |
46 | zstyle ':completion:*' insert-unambiguous false | |
47 | zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS} | |
48 | zstyle ':completion:*' list-prompt %SAt %p: Hit TAB for more, or the character to insert%s | |
49 | zstyle ':completion:*' matcher-list '' '+m:{[:lower:]}={[:upper:]} r:|[._-]=** r:|=**' '+l:|=* r:|=*' | |
50 | zstyle ':completion:*' max-errors 0 numeric | |
51 | zstyle ':completion:*' original true | |
52 | zstyle ':completion:*' verbose false | |
53 | zstyle ':completion:*:*:git*:*' verbose true | |
54 | ||
55 | _r () { words[1]=sudo; _normal; } | |
56 | compdef _r rootly | |
57 | compdef _ssh @ | |
58 | ||
59 | ###-------------------------------------------------------------------------- | |
60 | ### Other shell tweaking. | |
61 | ||
62 | HISTFILE=~/.zsh-history | |
63 | HISTSIZE=1000 | |
64 | SAVEHIST=1000 | |
65 | ||
66 | setopt appendhistory | |
67 | unsetopt auto_cd | |
68 | unsetopt auto_menu | |
69 | unsetopt bash_auto_list | |
70 | unsetopt beep | |
71 | setopt extendedglob | |
72 | setopt ksh_glob | |
73 | setopt list_ambiguous | |
74 | setopt list_packed | |
75 | unsetopt nomatch | |
76 | unsetopt menu_complete | |
77 | setopt notify | |
78 | ||
79 | zshaddhistory () { | |
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 -------------------------------------------------- |