]> git.openstreetmap.org Git - chef.git/blob - cookbooks/accounts/files/default/tomh/.zshrc
Add ssh key for daveh
[chef.git] / cookbooks / accounts / files / default / tomh / .zshrc
1 # Z-shell options
2 setopt ALL_EXPORT
3 setopt AUTO_CD
4 setopt AUTO_LIST
5 setopt AUTO_MENU
6 setopt CDABLE_VARS
7 setopt CORRECT
8 setopt CORRECT_ALL
9 setopt HIST_EXPIRE_DUPS_FIRST
10 setopt HIST_IGNORE_DUPS
11 setopt HIST_NO_STORE
12 setopt HIST_REDUCE_BLANKS
13 setopt HIST_SAVE_NO_DUPS
14 setopt INC_APPEND_HISTORY
15 setopt LIST_AMBIGUOUS
16 setopt LIST_TYPES
17 setopt LONG_LIST_JOBS
18 setopt NO_BEEP
19 setopt NO_NOMATCH
20 setopt NOTIFY
21 setopt PROMPT_SUBST
22 setopt PUSHD_SILENT
23 setopt SH_WORD_SPLIT
24
25 # Disable bracketed paste mode
26 unset zle_bracketed_paste
27
28 # Keep tramp happy
29 if [[ "$TERM" = "dumb" ]]
30 then
31     unsetopt ZLE
32 fi
33
34 # Fallback to a more basic terminal type if necessary
35 if [[ -z "${terminfo[cols]}" ]]
36 then
37     case "$TERM" in
38         xterm*) TERM="xterm";;
39     esac
40 fi
41
42 # Lock the terminal
43 ttyctl -f
44
45 # Make sure we know the username
46 if [[ -z "$USER" ]]
47 then
48     USER="$(id -un)"; export USER
49 fi
50
51 # Setup a default path
52 PATH=".:${HOME}/bin:/usr/local/bin:/bin:/usr/bin:/sbin:/usr/sbin"
53
54 # Setup a pager
55 PAGER="less"; export PAGER
56 LESS="aceiMRs"; export LESS
57
58 # Use vi for editing
59 EDITOR=/usr/bin/vi; export EDITOR
60 VISUAL=/usr/bin/vi; export VISUAL
61
62 # History setup
63 HISTFILE=$HOME/.zshhistory
64 SAVEHIST=1000
65 HISTSIZE=1500
66
67 # Ignore certain files when doing expansion
68 fignore=( \~ \# .o )
69
70 # Set the prompt
71 case "$TERM" in
72     xterm*) PROMPT="%{\e]0;\${ENVIRONMENT:+\${ENVIRONMENT} on} %M\a%}%m [%~] %# ";;
73     screen*) PROMPT="%{\ek\${ENVIRONMENT:+\${ENVIRONMENT} on} %M\e\%}%m [%~] %# ";;
74     *) PROMPT="%m [%~] %# ";;
75 esac
76
77 # Configure directory colours
78 eval "$(/usr/bin/dircolors --sh ${HOME}/.dir_colors)"
79
80 # Setup aliases
81 alias ls="ls -CFhv --color=auto"
82 alias df="df -h"
83 alias du="du -h"
84 alias grep="grep --color=auto"
85 alias egrep="egrep --color=auto"
86 alias fgrep="fgrep --color=auto"
87 alias cd="nocorrect cd"         # no spelling correction on cd
88 alias mv="nocorrect mv"         # no spelling correction on mv
89 alias cp="nocorrect cp"         # no spelling correction on cp
90 alias mkdir="nocorrect mkdir"   # no spelling correction on mkdir
91 alias man="nocorrect man"       # no spelling correction on man
92 alias pg="less"
93
94 # Select the emacs key map
95 bindkey -A emacs main
96
97 # Bind various keys - hard code xterm bindings to match linux xterms
98 case "$TERM" in
99     dumb)
100         ;;
101     xterm*)
102         bindkey "^[OA" history-beginning-search-backward
103         bindkey "^[[A" history-beginning-search-backward
104         bindkey "^[OB" history-beginning-search-forward
105         bindkey "^[[B" history-beginning-search-forward
106         bindkey "^[OH" beginning-of-line
107         bindkey "^[OF" end-of-line
108         bindkey "^[[2~" overwrite-mode
109         bindkey "^[[3~" delete-char;;
110     *)
111         bindkey "${terminfo[kcuu1]}" history-beginning-search-backward
112         bindkey "^[[A" history-beginning-search-backward
113         bindkey "${terminfo[kcud1]}" history-beginning-search-forward
114         bindkey "^[[B" history-beginning-search-forward
115         bindkey "${terminfo[khome]}" beginning-of-line
116         bindkey "${terminfo[kend]}" end-of-line
117         bindkey "${terminfo[kich1]}" overwrite-mode
118         bindkey "${terminfo[kdch1]}" delete-char;;
119 esac
120
121 # Configure completion
122 zstyle ":completion:*" completer _complete _approximate
123 zstyle ":completion:*" format "Completing %d"
124 zstyle ":completion:*" group-name ""
125 zstyle ":completion:*" menu select=long
126 zstyle ":completion:*" rehash true
127 zstyle ":completion:*" select-prompt "%SScrolling active: current selection at %p%s"
128
129 # Enable completion
130 autoload -U compinit
131 compinit
132
133 # Autoload all local functions
134 autoload ${HOME}/zshfuncs/*(:t)