wok-current view zsh/stuff/example.zshrc @ rev 7854
ruby: package with shared library, develop required.
author | Liu Peng <rocky@slitaz.org> |
---|---|
date | Wed Dec 29 08:15:41 2010 +0000 (2010-12-29) |
parents | |
children |
line source
1 # history
2 HISTFILE=~/.zsh_history
3 HISTSIZE=5000
4 SAVEHIST=1000
5 setopt appendhistory autocd extendedglob
6 setopt EXTENDED_HISTORY # puts timestamps in the history
8 # default apps
9 (( ${+BROWSER} )) || export BROWSER="w3m"
10 (( ${+PAGER} )) || export PAGER="less"
12 BLACK="%{"$'\033[01;30m'"%}"
13 GREEN="%{"$'\033[01;32m'"%}"
14 RED="%{"$'\033[01;31m'"%}"
15 YELLOW="%{"$'\033[01;33m'"%}"
16 BLUE="%{"$'\033[01;34m'"%}"
17 BOLD="%{"$'\033[01;39m'"%}"
18 NORM="%{"$'\033[00m'"%}"
21 # prompt (if running screen, show window #)
22 if [ x$WINDOW != x ]; then
23 export PS1="$WINDOW:%~%# "
24 else
25 export PS1="[${RED}%n${YELLOW}@${BLUE}%U%m%u$:${GREEN}%2c${NORM}]%(!.#.$) "
26 #right prompt - time/date stamp
27 export RPS1="${GREEN}(%D{%m-%d %H:%M})${NORM}"
28 fi
30 # format titles for screen and rxvt
31 function title() {
32 # escape '%' chars in $1, make nonprintables visible
33 a=${(V)1//\%/\%\%}
35 # Truncate command, and join lines.
36 a=$(print -Pn "%40>...>$a" | tr -d "\n")
38 case $TERM in
39 screen)
40 print -Pn "\ek$a:$3\e\\" # screen title (in ^A")
41 ;;
42 xterm*|rxvt)
43 print -Pn "\e]2;$2 | $a:$3\a" # plain xterm title
44 ;;
45 esac
46 }
48 # precmd is called just before the prompt is printed
49 function precmd() {
50 title "zsh" "$USER@%m" "%55<...<%~"
51 }
53 # preexec is called just before any command line is executed
54 function preexec() {
55 title "$1" "$USER@%m" "%35<...<%~"
56 }
58 # vi editing
59 bindkey -v
61 # colorful listings
62 zmodload -i zsh/complist
63 zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS}
65 autoload -U compinit
66 compinit
68 # aliases
69 alias mv='nocorrect mv' # no spelling correction on mv
70 alias cp='nocorrect cp'
71 alias mkdir='nocorrect mkdir'
72 alias j=jobs
73 if ls -F --color=auto >&/dev/null; then
74 alias ls="ls --color=auto -F"
75 else
76 alias ls="ls -F"
77 fi
78 alias ll="ls -l"
79 alias ..='cd ..'
80 alias .='pwd'
82 # functions
83 setenv() { export $1=$2 } # csh compatibility
85 #bash style ctrl-a (beginning of line) and ctrl-e (end of line)
86 bindkey '^a' beginning-of-line
87 bindkey '^e' end-of-line
89 # Emulate tcsh's backward-delete-word
90 tcsh-backward-delete-word () {
91 #local WORDCHARS="${WORDCHARS:s#/#}"
92 local WORDCHARS='*?_[]~\!#$%^<>|`@#$%^*()+?'
93 zle backward-delete-word
94 }
96 zle -N tcsh-backward-delete-word
98 bindkey '\e^H' tcsh-backward-delete-word
100 #if this is uncommented, it will ignore the stop-at-special-chars
101 #bindkey '\e^H' backward-delete-word
103 #uncomment this to have a nice update script that will cause ur zshrc to update from a central location
105 #selfupdate(){
106 # URL="http://stuff.mit.edu/~jdong/misc/zshrc"
107 # echo "Updating zshrc from $URL..."
108 # echo "Press Ctrl+C within 5 seconds to abort..."
109 # sleep 5
110 # cp ~/.zshrc ~/.zshrc.old
111 # wget $URL -O ~/.zshrc
112 # echo "Done; existing .zshrc saved as .zshrc.old"
113 #}