]> git.draconx.ca Git - zshconf.git/blob - zshrc
zshrc: Cleanup.
[zshconf.git] / zshrc
1 if [[ -n $HOME ]]; then
2         HISTFILE=$HOME/.zsh_history
3         SAVEHIST=1000
4 fi
5 HISTSIZE=1000
6
7 bindkey -e
8
9 case $TERM in
10 rxvt*)
11         if [[ $TERM == rxvt-unicode ]]; then
12                 [[ -z $COLORTERM ]] && export COLORTERM='rxvt-xpm'
13                 [[ -z $COLORFGBG ]] && export COLORFGBG='15;default;0'
14         fi
15
16         bindkey '\e[3~' delete-char
17         bindkey '\e[8~' end-of-line
18         bindkey '\e[7~' beginning-of-line
19 ;;
20 screen*|linux)
21         bindkey '\e[3~' delete-char
22         bindkey '\e[4~' end-of-line
23         bindkey '\e[1~' beginning-of-line
24 ;;
25 xterm)
26         bindkey '\e[3~' delete-char
27         bindkey '\e[F'  end-of-line
28         bindkey '\e[H'  beginning-of-line
29         bindkey '\eOH'  beginning-of-line
30         bindkey '\eOF'  end-of-line
31 ;;
32 esac
33
34 # Set the xterm title
35 case $TERM in
36         xterm*|rxvt*|Eterm|aterm|kterm|gnome*)
37                 settitle() { print -Pn $'\e]0;%n@%m %33<...<%~%<<\a' }
38                 ;;
39         screen)
40                 settitle() { print -Pn $'\e_%n@%m %33<...<%~%<<\e\\' }
41                 ;;
42         *)
43                 settitle() { }
44                 ;;
45 esac
46
47 # Show the return code of failed commands, but don't be noisy about it.
48 precmd() {
49         settitle
50
51         if [[ -n $__NEWRUN ]]; then
52                 RPS1='%(0?,,%B%F{red}RC=%?%f%b)'
53                 unset __NEWRUN
54         else
55                 unset RPS1
56         fi
57 }
58
59 preexec() {
60         __NEWRUN=yes
61 }
62
63 # A gentoo-like prompt.
64 PS1='%B%(!,%F{red},%F{green}%n@)%m %F{blue}%33<...<%~%<< %#%f%b '
65
66 if [ -n $COLORTERM ]; then
67         # Assorted colour-related options
68         export MINICOM="-c on"
69 fi
70
71 if [[ -n $SSH_CONNECTION ]]; then
72         PS1=${PS1/green/yellow}
73 fi
74
75 # Locale
76 export LANG=en_CA.UTF-8
77 export LC_COLLATE=ja_JP.UTF-8
78
79 # I like colours
80 alias ls='ls --color=auto'
81 alias grep='grep --color=auto'
82
83 # I hate mistakes
84 alias mv='mv -i'
85 alias rm='rm -i'
86 alias cp='cp -i'