877798900e514ab6f400869bdd218fe2256f4f3c
[shutils.git] / dotfiles / shell / zshrc
1 # sample by Peter Palfrader: http://svn.noreply.org/svn/weaselutils/trunk/dotfiles/zshrc
2
3 [ -r /etc/zsh/zprofile ] && source /etc/zsh/zprofile
4 [ -r $HOME/.profile ] && source $HOME/.profile
5
6
7 bindkey -e
8 zstyle :compinstall filename "$HOME/.zshrc"
9
10 autoload -Uz compinit
11 compinit
12
13 if [ -e $HOME/.bash_completion ]; then
14 autoload bashcompinit
15 bashcompinit
16 source $HOME/.bash_completion
17 fi
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 for color in RED GREEN YELLOW BLUE MAGENTA CYAN WHITE; do
74 eval PR_$color='%{$terminfo[bold]$fg[${(L)color}]%}'
75 eval PR_LIGHT_$color='%{$fg[${(L)color}]%}'
76 done
77 PR_BOLD="%{$terminfo[bold]%}"
78 PR_NO_COLOUR="%{$terminfo[sgr0]%}"
79
80 HISTFILE=~/.zsh_history
81 HISTSIZE=50000
82 SAVEHIST=50000
83 REPORTTIME=5
84 TIMEFMT="$terminfo[bold]$fg[yellow]%J %U user %S sys %P cpu %*E total %M kB max$terminfo[sgr0]"
85
86 autoload -Uz vcs_info && vcs_info
87 zstyle ':vcs_info:*' enable git cvs svn hg
88 zstyle ':vcs_info:*' use-prompt-escapes
89 zstyle ':vcs_info:*' max-exports 1
90
91
92 function setprompt()
93 {
94 # default: " (%s)-[%b|%a]%u%c-"
95 zstyle ':vcs_info:*' actionformats "${PR_YELLOW}%s:%b|%a${PR_NO_COLOUR} "
96 # default: " (%s)-[%b]%u%c-"
97 zstyle ':vcs_info:*' formats "${PR_YELLOW}%s:%b${PR_NO_COLOUR} "
98
99 setopt PROMPT_SUBST
100 PROMPT='%(!.$PR_RED.$PR_GREEN)%n@%m $PR_BLUE%1~ %# $PR_NO_COLOUR'
101 RPROMPT='${vcs_info_msg_0_}${PR_STUFF}'
102 }
103 setprompt
104
105
106 function precmd ()
107 {
108 local exitstatus="${?}"
109 PR_STUFF=" "
110 if [[ 0 -ne "${exitstatus}" ]] ; then
111 PR_STUFF="${PR_RED}RET ${exitstatus}${PR_NO_COLOUR}"
112 fi
113 vcs_info
114 }
115
116
117