chiark / gitweb /
dot/putty-defaults: Try a blinking bar cursor for size.
[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
a797cf50
MW
33bindkey -e
34
d7b20e5c
MW
35for w in \
36 forward-word backward-word kill-word backward-kill-word \
37 transpose-words capitalize-word up-case-word down-case-word \
38 delete-whole-word select-word
39do
40 autoload -U $w-match
41 zle -N $w-bash $w-match
42 zle -N $w-shell $w-match
43 zstyle ':zle:*-bash' word-style standard
44 zstyle ':zle:*-bash' skip-whitespace-first true
45 zstyle ':zle:*-bash' word-chars ""
46 zstyle ':zle:*-shell' word-style shell
47 zstyle ':zle:*-shell' skip-whitespace-first false
48done
49
50bindkey "\eb" backward-word-bash
51bindkey "\e^b" backward-word-shell
52bindkey "\ef" forward-word-bash
53bindkey "\e^f" forward-word-shell
54bindkey "\e^?" backward-kill-word-bash
55bindkey "^w" backward-kill-word-shell
56bindkey "\ed" kill-word-bash
57bindkey "\e^d" kill-word-shell
58bindkey "\et" transpose-words-bash
59bindkey "\e^t" transpose-words-shell
60bindkey "\eu" up-case-word-bash
61bindkey "\e^u" up-case-word-shell
62bindkey "\el" up-case-word-bash
63bindkey "\e^l" up-case-word-shell
64bindkey "\ec" capitalize-word-bash
65bindkey "\e^c" capitalize-word-shell
66
eda14eb9
MW
67bindkey "\ep" history-beginning-search-backward
68bindkey "\en" history-beginning-search-forward
69
a897ee2c
MW
70setopt interactive_comments
71bindkey "\e#" pound-insert
72
c510f8b9
MW
73__mdw_delete_horizontal_space () {
74 LBUFFER=${LBUFFER%%[[:space:]]##}
75 RBUFFER=${RBUFFER##[[:space:]]##}
76}
77zle -N delete-horizontal-space __mdw_delete_horizontal_space
78bindkey "\e\\" delete-horizontal-space
79
80__mdw_just_one_space () {
81 LBUFFER="${LBUFFER%%[[:space:]]##} "
82 RBUFFER=${RBUFFER##[[:space:]]##}
83}
84zle -N just-one-space __mdw_just_one_space
85bindkey "\e " just-one-space
86
87
a797cf50
MW
88###--------------------------------------------------------------------------
89### Completion.
90
91## Initialize the fancy completion machinery.
92autoload -Uz compinit
93compinit
94
95## Contexts: :completion:FUNCTION:COMPLETER:COMMAND:ARGUMENT:TAG
96zstyle ':completion:*' completer _expand _complete _ignored _approximate
97zstyle ':completion:*' insert-unambiguous false
98zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS}
99zstyle ':completion:*' list-prompt %SAt %p: Hit TAB for more, or the character to insert%s
100zstyle ':completion:*' matcher-list '' '+m:{[:lower:]}={[:upper:]} r:|[._-]=** r:|=**' '+l:|=* r:|=*'
101zstyle ':completion:*' max-errors 0 numeric
102zstyle ':completion:*' original true
103zstyle ':completion:*' verbose false
104zstyle ':completion:*:*:git*:*' verbose true
105
106_r () { words[1]=sudo; _normal; }
107compdef _r rootly
108compdef _ssh @
109
110###--------------------------------------------------------------------------
111### Other shell tweaking.
112
113HISTFILE=~/.zsh-history
114HISTSIZE=1000
115SAVEHIST=1000
116
117setopt appendhistory
118unsetopt auto_cd
119unsetopt auto_menu
120unsetopt bash_auto_list
121unsetopt beep
122setopt extendedglob
123setopt ksh_glob
124setopt list_ambiguous
125setopt list_packed
126unsetopt nomatch
127unsetopt menu_complete
128setopt notify
129
130zshaddhistory () {
131 case "$1" in
132 " "*) return 2 ;;
133 *) return 0 ;;
134 esac
135}
136
137###--------------------------------------------------------------------------
138### Finishing touches.
139
140__mdw_source_if_exists "$HOME/.zshrc-local"
141
142###----- That's all, folks --------------------------------------------------