]> git.draconx.ca Git - zshconf.git/blob - zshrc
Enable extended globs by default.
[zshconf.git] / zshrc
1 # Configuration for interactive shells.
2 #
3 # Copyright (C) 2009 Nick Bowler
4 #
5 # Copying and distribution of this file, with or without modification,
6 # are permitted in any medium without royalty provided the copyright
7 # notice and this notice are preserved.  This file is offered as-is,
8 # without any warranty.
9
10 # Default shell options
11 setopt EXTENDED_GLOB
12
13 if [[ -n $HOME ]]; then
14         HISTFILE=$HOME/.zsh_history
15         SAVEHIST=10000
16 fi
17 HISTSIZE=10000
18
19 bindkey -e
20
21 case $TERM in
22 rxvt*)
23         if [[ $TERM =~ '^rxvt-unicode' ]]; then
24                 [[ -z $COLORTERM ]] && export COLORTERM='rxvt-xpm'
25                 [[ -z $COLORFGBG ]] && export COLORFGBG='15;default;0'
26         fi
27
28         bindkey '\e[3~' delete-char
29         bindkey '\e[8~' end-of-line
30         bindkey '\e[7~' beginning-of-line
31 ;;
32 screen*|linux|cygwin)
33         bindkey '\e[3~' delete-char
34         bindkey '\e[4~' end-of-line
35         bindkey '\e[1~' beginning-of-line
36         bindkey '\eOM'  accept-line
37 ;;
38 xterm*)
39         bindkey '\e[3~' delete-char
40         bindkey '\e[F'  end-of-line
41         bindkey '\e[H'  beginning-of-line
42         bindkey '\eOH'  beginning-of-line
43         bindkey '\eOF'  end-of-line
44 ;;
45 cons25)
46         bindkey '^?'    delete-char
47         bindkey '\e[F'  end-of-line
48         bindkey '\e[H'  beginning-of-line
49 ;;
50 esac
51
52 # Keymap-specific bindings
53 case $KEYMAP in
54 colemak)
55         bindkey '^R'    history-incremental-search-forward
56         bindkey '^P'    history-incremental-search-backward
57         ;;
58 esac
59
60 # Set the xterm title
61 case $TERM in
62         xterm*|rxvt*|Eterm|aterm|kterm|gnome*)
63                 settitle() { print -Pn $'\e]0;%n@%m %33<...<%~%<<\a' }
64                 ;;
65         screen)
66                 settitle() { print -Pn $'\e_%n@%m %33<...<%~%<<\e\\' }
67                 ;;
68         *)
69                 settitle() { }
70                 ;;
71 esac
72
73 # Show the return code of failed commands, but don't be noisy about it.
74 precmd() {
75         settitle
76
77         if [[ -n $__NEWRUN ]]; then
78                 RPS1='%(0?,,%B%F{red}RC=%?%f%b)'
79                 unset __NEWRUN
80         else
81                 unset RPS1
82         fi
83 }
84
85 preexec() {
86         __NEWRUN=yes
87 }
88
89 # A gentoo-like prompt.
90 PS1='%B%(!,%F{red},%F{green}%n@)%m %F{blue}%33<...<%~%<< %#%f%b '
91
92 if [ -n $COLORTERM ]; then
93         # Assorted colour-related options
94         export MINICOM="-c on"
95 fi
96
97 if [[ -n $SSH_CONNECTION ]]; then
98         PS1=${PS1/green/yellow}
99 fi
100
101 # Locale
102 export LANG=en_CA.UTF-8
103 export LC_COLLATE=ja_JP.UTF-8
104
105 # Default options for various utilities.
106 alias ls='ls --time-style=long-iso --color=auto'
107 alias grep='grep --color=auto'
108
109 # I hate mistakes
110 alias mv='mv -i'
111 alias rm='rm -i'
112 alias cp='cp -i'
113
114 # Common aliases
115 alias vv='$EDITOR ~/.zshrc && source ~/.zshrc'
116 alias ll='ls -l'
117 alias lr='ls -rtl'