chiark / gitweb /
dot/gitconfig.in: Abolish the `git email' alias.
[profile] / dot / zshrc
... / ...
CommitLineData
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 more=%F{green}%_%f
22}
23
24if [ -t 0 ]; then
25 __mdw_source_if_exists /usr/lib/git-core/git-sh-prompt
26 __mdw_set_prompt_pieces
27 precmd_functions+=(__mdw_precmd)
28 preexec_functions+=(__mdw_preexec)
29fi
30
31###--------------------------------------------------------------------------
32### Line editing.
33
34case $TERM in dumb) unsetopt zle ;; esac
35
36bindkey -e
37
38for w in \
39 forward-word backward-word kill-word backward-kill-word \
40 transpose-words capitalize-word up-case-word down-case-word \
41 delete-whole-word select-word
42do
43 autoload -U $w-match
44 zle -N $w-bash $w-match
45 zle -N $w-shell $w-match
46 zstyle ':zle:*-bash' word-style standard
47 zstyle ':zle:*-bash' skip-whitespace-first true
48 zstyle ':zle:*-bash' word-chars ""
49 zstyle ':zle:*-shell' word-style shell
50 zstyle ':zle:*-shell' skip-whitespace-first false
51done
52
53bindkey "\eb" backward-word-bash
54bindkey "\e^b" backward-word-shell
55bindkey "\ef" forward-word-bash
56bindkey "\e^f" forward-word-shell
57bindkey "\e^?" backward-kill-word-bash
58bindkey "^w" backward-kill-word-shell
59bindkey "\ed" kill-word-bash
60bindkey "\e^d" kill-word-shell
61bindkey "\et" transpose-words-bash
62bindkey "\e^t" transpose-words-shell
63bindkey "\eu" up-case-word-bash
64bindkey "\e^u" up-case-word-shell
65bindkey "\el" down-case-word-bash
66bindkey "\e^l" down-case-word-shell
67bindkey "\ec" capitalize-word-bash
68bindkey "\e^c" capitalize-word-shell
69
70bindkey "\e[1~" beginning-of-line "\e[4~" end-of-line
71
72bindkey -s "\eOQ" "/" "\eOR" "*" "\eOS" "-"
73bindkey -s "\eOw" "7" "\eOx" "8" "\eOy" "9"
74bindkey -s "\eOt" "4" "\eOu" "5" "\eOv" "6" "\eOk" "+"
75bindkey -s "\eOq" "1" "\eOr" "2" "\eOs" "3"
76bindkey -s "\eOp" "0" "\eOn" "."; bindkey "\eOM" accept-line
77
78bindkey -s "\eOQ" "/" "\eOR" "*" "\eOS" "-"
79bindkey -s "\eOw" "7" "\eOx" "8" "\eOy" "9"
80bindkey -s "\eOt" "4" "\eOu" "5" "\eOv" "6" "\eOk" "+"
81bindkey -s "\eOq" "1" "\eOr" "2" "\eOs" "3"
82bindkey -s "\eOp" "0" "\eOn" "."; bindkey "\eOM" accept-line
83
84bindkey "\ep" history-beginning-search-backward
85bindkey "\en" history-beginning-search-forward
86
87setopt interactive_comments
88bindkey "\e#" pound-insert
89
90__mdw_delete_horizontal_space () {
91 LBUFFER=${LBUFFER%%[[:space:]]##}
92 RBUFFER=${RBUFFER##[[:space:]]##}
93}
94zle -N delete-horizontal-space __mdw_delete_horizontal_space
95bindkey "\e\\" delete-horizontal-space
96
97__mdw_just_one_space () {
98 LBUFFER="${LBUFFER%%[[:space:]]##} "
99 RBUFFER=${RBUFFER##[[:space:]]##}
100}
101zle -N just-one-space __mdw_just_one_space
102bindkey "\e " just-one-space
103
104###--------------------------------------------------------------------------
105### Completion.
106
107## Contexts: :completion:FUNCTION:COMPLETER:COMMAND:ARGUMENT:TAG
108zstyle ':completion:*' completer _expand _complete _ignored _approximate
109zstyle ':completion:*' insert-unambiguous false
110zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS}
111zstyle ':completion:*' list-prompt %SAt %p: Hit TAB for more, or the character to insert%s
112zstyle ':completion:*' matcher-list '' '+m:{[:lower:]}={[:upper:]} r:|[._-]=** r:|=**' '+l:|=* r:|=*'
113zstyle ':completion:*' max-errors 0 numeric
114zstyle ':completion:*' original true
115zstyle ':completion:*' verbose false
116zstyle ':completion:*:*:git*:*' verbose true
117
118## Initialize the fancy completion machinery.
119autoload -Uz compinit
120compinit
121
122_r () { words[1]=sudo; _normal; }
123compdef _r rootly
124compdef _ssh @
125
126###--------------------------------------------------------------------------
127### Other shell tweaking.
128
129HISTFILE=~/.zsh-history
130HISTSIZE=1000
131SAVEHIST=1000
132
133unsetopt auto_cd
134unsetopt auto_menu
135setopt bang_hist
136unsetopt bash_auto_list
137unsetopt beep
138setopt extendedglob
139unsetopt flow_control
140setopt glob_star_short
141setopt hist_ignore_all_dups
142setopt hist_ignore_space
143setopt ksh_glob
144setopt list_ambiguous
145setopt list_packed
146setopt multios
147unsetopt nomatch
148unsetopt menu_complete
149setopt notify
150setopt rc_expand_param
151setopt share_history
152
153###--------------------------------------------------------------------------
154### Finishing touches.
155
156## Local tweaks.
157__mdw_source_if_exists "$HOME/.zshrc-local"
158
159###----- That's all, folks --------------------------------------------------