Add zshrc
[shutils.git] / dotfiles / zshrc
1 [ -r /etc/zsh/zprofile ] && source /etc/zsh/zprofile
2 [ -r $HOME/.profile ] && source $HOME/.profile
3
4
5 bindkey -e
6 zstyle :compinstall filename "$HOME/.zshrc"
7
8 autoload -Uz compinit
9 compinit
10
11 if [ -e $HOME/.bash_completion ]; then
12 autoload bashcompinit
13 bashcompinit
14 source $HOME/.bash_completion
15 fi
16
17
18
19 autoload colors zsh/terminfo
20 if [[ "$terminfo[colors]" -ge 8 ]]; then
21 colors
22 fi
23
24 eval `dircolors`
25 LS_COLORS="${LS_COLORS}*.divx=01;35:"
26 zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS}
27
28 zstyle ':completion:*' menu select
29 zmodload -i zsh/complist
30
31
32
33 # bind special keys according to readline configuration
34 #eval "$(sed -n 's/^/bindkey /; s/: / /p' /etc/inputrc)"
35
36 bindkey "\e[1~" beginning-of-line
37 bindkey "\e[4~" end-of-line
38 bindkey "\e[5~" history-search-backward
39 bindkey "\e[6~" history-search-forward
40 bindkey "\e[3~" delete-char
41 bindkey "\e[2~" quoted-insert
42 bindkey "\e[5C" forward-word
43 bindkey "\e[5D" backward-word
44 bindkey "\e\e[C" forward-word
45 bindkey "\e\e[D" backward-word
46 bindkey "\e[1;5C" forward-word
47 bindkey "\e[1;5D" backward-word
48 bindkey "\eOc" forward-word
49 bindkey "\eOd" backward-word
50 bindkey "\e[1;3C" forward-word
51 bindkey "\e[1;3D" backward-word
52 bindkey "\e[8~" end-of-line
53 bindkey "\eOH" beginning-of-line
54 bindkey "\eOF" end-of-line
55 bindkey "\e[H" beginning-of-line
56 bindkey "\e[F" end-of-line
57 bindkey "\e[7~" beginning-of-line
58 bindkey "\e[8~" end-of-line
59
60
61
62 setopt \
63 EXTENDEDGLOB \
64 BASH_AUTO_LIST \
65 LIST_AMBIGUOUS \
66 CHECK_JOBS \
67 INC_APPEND_HISTORY \
68 HIST_IGNORE_DUPS \
69 HIST_IGNORE_SPACE \
70 NO_HUP
71
72
73 HISTFILE=~/.zsh_history
74 HISTSIZE=50000
75 SAVEHIST=50000
76 REPORTTIME=5
77
78 autoload -Uz vcs_info && vcs_info
79 zstyle ':vcs_info:*' enable git cvs svn hg
80 zstyle ':vcs_info:*' use-prompt-escapes
81 zstyle ':vcs_info:*' max-exports 1
82
83
84 function setprompt() {
85
86 for color in RED GREEN YELLOW BLUE MAGENTA CYAN WHITE; do
87 eval PR_$color='%{$terminfo[bold]$fg[${(L)color}]%}'
88 eval PR_LIGHT_$color='%{$fg[${(L)color}]%}'
89 done
90 PR_BOLD="%{$terminfo[bold]%}"
91 PR_NO_COLOUR="%{$terminfo[sgr0]%}"
92
93 zstyle ':vcs_info:*' actionformats "${PR_YELLOW}[%b|%a]${PR_NO_COLOUR} "
94 zstyle ':vcs_info:*' formats "${PR_YELLOW}[%b]${PR_NO_COLOUR} "
95
96 setopt PROMPT_SUBST
97 PROMPT='%(!.$PR_RED.$PR_GREEN)%n@%m $PR_BLUE%1~ %# $PR_NO_COLOUR'
98 RPROMPT='${vcs_info_msg_0_}$PR_CYAN?%?$PR_NO_COLOUR'
99 }
100 setprompt
101
102
103 function precmd () {
104 vcs_info
105 }
106
107
108