bin/wakey.zsh: Don't turn on if `WINDOWID' isn't set.
[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
8a075bd7 15 linux*|screen*|xterm*|putty*|vt100*|eterm*)
a797cf50
MW
16 bold=%B unbold=%b
17 gitcolour=%F{cyan} rccolour=%F{red} uncolour=%f
18 ;;
19 esac
3fa9aa25 20 host=%m dir=" %(6~!%-1~/.../%4~!%~)"
778e2af4 21 more=%F{green}%_%f
a797cf50
MW
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
dbd3e351
MW
34case $TERM in dumb) unsetopt zle ;; esac
35
a797cf50
MW
36bindkey -e
37
d7b20e5c
MW
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
e3674277
MW
65bindkey "\el" down-case-word-bash
66bindkey "\e^l" down-case-word-shell
d7b20e5c
MW
67bindkey "\ec" capitalize-word-bash
68bindkey "\e^c" capitalize-word-shell
69
2a0e079f
MW
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
eda14eb9
MW
84bindkey "\ep" history-beginning-search-backward
85bindkey "\en" history-beginning-search-forward
af8517d9
MW
86bindkey "\e," _history-complete-older
87
88for i in '!' '$' '@' '/' '~'; do
89 bindkey "\e$i" _bash_complete-word
90 bindkey "^X$i" _bash_list-choices
91done
eda14eb9 92
a897ee2c
MW
93setopt interactive_comments
94bindkey "\e#" pound-insert
95
c510f8b9
MW
96__mdw_delete_horizontal_space () {
97 LBUFFER=${LBUFFER%%[[:space:]]##}
98 RBUFFER=${RBUFFER##[[:space:]]##}
99}
100zle -N delete-horizontal-space __mdw_delete_horizontal_space
101bindkey "\e\\" delete-horizontal-space
102
103__mdw_just_one_space () {
104 LBUFFER="${LBUFFER%%[[:space:]]##} "
105 RBUFFER=${RBUFFER##[[:space:]]##}
106}
107zle -N just-one-space __mdw_just_one_space
108bindkey "\e " just-one-space
109
a797cf50
MW
110###--------------------------------------------------------------------------
111### Completion.
112
a797cf50
MW
113## Contexts: :completion:FUNCTION:COMPLETER:COMMAND:ARGUMENT:TAG
114zstyle ':completion:*' completer _expand _complete _ignored _approximate
115zstyle ':completion:*' insert-unambiguous false
116zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS}
117zstyle ':completion:*' list-prompt %SAt %p: Hit TAB for more, or the character to insert%s
118zstyle ':completion:*' matcher-list '' '+m:{[:lower:]}={[:upper:]} r:|[._-]=** r:|=**' '+l:|=* r:|=*'
119zstyle ':completion:*' max-errors 0 numeric
120zstyle ':completion:*' original true
121zstyle ':completion:*' verbose false
122zstyle ':completion:*:*:git*:*' verbose true
123
818cdbb4
MW
124## Initialize the fancy completion machinery.
125autoload -Uz compinit
126compinit
127
a797cf50
MW
128_r () { words[1]=sudo; _normal; }
129compdef _r rootly
130compdef _ssh @
131
132###--------------------------------------------------------------------------
133### Other shell tweaking.
134
135HISTFILE=~/.zsh-history
136HISTSIZE=1000
137SAVEHIST=1000
138
a797cf50
MW
139unsetopt auto_cd
140unsetopt auto_menu
cba93353 141setopt bang_hist
a797cf50
MW
142unsetopt bash_auto_list
143unsetopt beep
144setopt extendedglob
f00452f2 145unsetopt flow_control
f911124e 146unsetopt global_export
f8927ad9 147setopt glob_star_short
e3c70a77 148setopt hist_ignore_all_dups
68d1e406 149setopt hist_ignore_space
cfcfc91b 150unsetopt ksh_glob
a797cf50
MW
151setopt list_ambiguous
152setopt list_packed
043b866b 153setopt multios
a797cf50
MW
154unsetopt nomatch
155unsetopt menu_complete
156setopt notify
043b866b 157setopt rc_expand_param
e3c70a77 158setopt share_history
a797cf50 159
21ba66ed
MW
160hash -d t=$TMPDIR
161
a797cf50
MW
162###--------------------------------------------------------------------------
163### Finishing touches.
164
e22144cd 165## Local tweaks.
a797cf50
MW
166__mdw_source_if_exists "$HOME/.zshrc-local"
167
168###----- That's all, folks --------------------------------------------------