dot/shrc: Add missing trailer line.
[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
3b41df91
MW
8###--------------------------------------------------------------------------
9### Common shell configuration.
10
a797cf50
MW
11. "$HOME/.shell-rc"
12
13###--------------------------------------------------------------------------
14### Prompt hacking.
15
16__mdw_set_prompt_hacks () {
17 case $TERM in
8a075bd7 18 linux*|screen*|xterm*|putty*|vt100*|eterm*)
a797cf50
MW
19 bold=%B unbold=%b
20 gitcolour=%F{cyan} rccolour=%F{red} uncolour=%f
21 ;;
22 esac
3fa9aa25 23 host=%m dir=" %(6~!%-1~/.../%4~!%~)"
778e2af4 24 more=%F{green}%_%f
a797cf50
MW
25}
26
27if [ -t 0 ]; then
28 __mdw_source_if_exists /usr/lib/git-core/git-sh-prompt
29 __mdw_set_prompt_pieces
30 precmd_functions+=(__mdw_precmd)
31 preexec_functions+=(__mdw_preexec)
32fi
33
34###--------------------------------------------------------------------------
35### Line editing.
36
dbd3e351
MW
37case $TERM in dumb) unsetopt zle ;; esac
38
a797cf50
MW
39bindkey -e
40
d7b20e5c
MW
41for w in \
42 forward-word backward-word kill-word backward-kill-word \
43 transpose-words capitalize-word up-case-word down-case-word \
44 delete-whole-word select-word
45do
46 autoload -U $w-match
47 zle -N $w-bash $w-match
48 zle -N $w-shell $w-match
49 zstyle ':zle:*-bash' word-style standard
50 zstyle ':zle:*-bash' skip-whitespace-first true
51 zstyle ':zle:*-bash' word-chars ""
52 zstyle ':zle:*-shell' word-style shell
53 zstyle ':zle:*-shell' skip-whitespace-first false
54done
55
56bindkey "\eb" backward-word-bash
57bindkey "\e^b" backward-word-shell
58bindkey "\ef" forward-word-bash
59bindkey "\e^f" forward-word-shell
60bindkey "\e^?" backward-kill-word-bash
61bindkey "^w" backward-kill-word-shell
62bindkey "\ed" kill-word-bash
63bindkey "\e^d" kill-word-shell
64bindkey "\et" transpose-words-bash
65bindkey "\e^t" transpose-words-shell
66bindkey "\eu" up-case-word-bash
67bindkey "\e^u" up-case-word-shell
e3674277
MW
68bindkey "\el" down-case-word-bash
69bindkey "\e^l" down-case-word-shell
d7b20e5c
MW
70bindkey "\ec" capitalize-word-bash
71bindkey "\e^c" capitalize-word-shell
72
2a0e079f
MW
73bindkey "\e[1~" beginning-of-line "\e[4~" end-of-line
74
75bindkey -s "\eOQ" "/" "\eOR" "*" "\eOS" "-"
76bindkey -s "\eOw" "7" "\eOx" "8" "\eOy" "9"
77bindkey -s "\eOt" "4" "\eOu" "5" "\eOv" "6" "\eOk" "+"
78bindkey -s "\eOq" "1" "\eOr" "2" "\eOs" "3"
79bindkey -s "\eOp" "0" "\eOn" "."; bindkey "\eOM" accept-line
80
81bindkey -s "\eOQ" "/" "\eOR" "*" "\eOS" "-"
82bindkey -s "\eOw" "7" "\eOx" "8" "\eOy" "9"
83bindkey -s "\eOt" "4" "\eOu" "5" "\eOv" "6" "\eOk" "+"
84bindkey -s "\eOq" "1" "\eOr" "2" "\eOs" "3"
85bindkey -s "\eOp" "0" "\eOn" "."; bindkey "\eOM" accept-line
86
eda14eb9
MW
87bindkey "\ep" history-beginning-search-backward
88bindkey "\en" history-beginning-search-forward
af8517d9
MW
89bindkey "\e," _history-complete-older
90
91for i in '!' '$' '@' '/' '~'; do
92 bindkey "\e$i" _bash_complete-word
93 bindkey "^X$i" _bash_list-choices
94done
eda14eb9 95
a897ee2c
MW
96setopt interactive_comments
97bindkey "\e#" pound-insert
98
c510f8b9
MW
99__mdw_delete_horizontal_space () {
100 LBUFFER=${LBUFFER%%[[:space:]]##}
101 RBUFFER=${RBUFFER##[[:space:]]##}
102}
103zle -N delete-horizontal-space __mdw_delete_horizontal_space
104bindkey "\e\\" delete-horizontal-space
105
106__mdw_just_one_space () {
107 LBUFFER="${LBUFFER%%[[:space:]]##} "
108 RBUFFER=${RBUFFER##[[:space:]]##}
109}
110zle -N just-one-space __mdw_just_one_space
111bindkey "\e " just-one-space
112
a797cf50
MW
113###--------------------------------------------------------------------------
114### Completion.
115
a797cf50
MW
116## Contexts: :completion:FUNCTION:COMPLETER:COMMAND:ARGUMENT:TAG
117zstyle ':completion:*' completer _expand _complete _ignored _approximate
118zstyle ':completion:*' insert-unambiguous false
119zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS}
120zstyle ':completion:*' list-prompt %SAt %p: Hit TAB for more, or the character to insert%s
121zstyle ':completion:*' matcher-list '' '+m:{[:lower:]}={[:upper:]} r:|[._-]=** r:|=**' '+l:|=* r:|=*'
122zstyle ':completion:*' max-errors 0 numeric
123zstyle ':completion:*' original true
124zstyle ':completion:*' verbose false
125zstyle ':completion:*:*:git*:*' verbose true
126
818cdbb4
MW
127## Initialize the fancy completion machinery.
128autoload -Uz compinit
129compinit
130
a797cf50
MW
131_r () { words[1]=sudo; _normal; }
132compdef _r rootly
133compdef _ssh @
134
135###--------------------------------------------------------------------------
136### Other shell tweaking.
137
138HISTFILE=~/.zsh-history
139HISTSIZE=1000
140SAVEHIST=1000
141
a797cf50
MW
142unsetopt auto_cd
143unsetopt auto_menu
cba93353 144setopt bang_hist
a797cf50
MW
145unsetopt bash_auto_list
146unsetopt beep
147setopt extendedglob
f00452f2 148unsetopt flow_control
f911124e 149unsetopt global_export
f8927ad9 150setopt glob_star_short
e3c70a77 151setopt hist_ignore_all_dups
68d1e406 152setopt hist_ignore_space
cfcfc91b 153unsetopt ksh_glob
a797cf50
MW
154setopt list_ambiguous
155setopt list_packed
043b866b 156setopt multios
a797cf50
MW
157unsetopt nomatch
158unsetopt menu_complete
159setopt notify
043b866b 160setopt rc_expand_param
e3c70a77 161setopt share_history
a797cf50 162
21ba66ed
MW
163hash -d t=$TMPDIR
164
a797cf50
MW
165###--------------------------------------------------------------------------
166### Finishing touches.
167
e22144cd 168## Local tweaks.
a797cf50
MW
169__mdw_source_if_exists "$HOME/.zshrc-local"
170
171###----- That's all, folks --------------------------------------------------