| 1 | # http://devel.aquahill.net/zsh/dot.zshrc |
|---|
| 2 | echo "Loading $HOME/.zshrc" |
|---|
| 3 | |
|---|
| 4 | ### environment variables |
|---|
| 5 | export EDITOR=vim |
|---|
| 6 | export GISTY_DIR="$HOME/dev/gists" |
|---|
| 7 | |
|---|
| 8 | ### shell variables |
|---|
| 9 | HISTFILE=$HOME/.zsh_history |
|---|
| 10 | HISTSIZE=1024 |
|---|
| 11 | # http://journal.mycom.co.jp/column/zsh/002/index.html |
|---|
| 12 | PROMPT="[%n@%m]%~%#" |
|---|
| 13 | SAVEHIST=2048 |
|---|
| 14 | VIMRC=$HOME/.vimrc |
|---|
| 15 | |
|---|
| 16 | ### key bindings |
|---|
| 17 | bindkey -e |
|---|
| 18 | |
|---|
| 19 | # historical backward/forward search with linehead string binded to ^P/^N |
|---|
| 20 | autoload history-search-end |
|---|
| 21 | zle -N history-beginning-search-backward-end history-search-end |
|---|
| 22 | zle -N history-beginning-search-forward-end history-search-end |
|---|
| 23 | bindkey "^p" history-beginning-search-backward-end |
|---|
| 24 | bindkey "^n" history-beginning-search-forward-end |
|---|
| 25 | bindkey "^[/" expand-cmd-path |
|---|
| 26 | |
|---|
| 27 | zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}' |
|---|
| 28 | |
|---|
| 29 | # http://hatena.g.hatena.ne.jp/hatenatech/20060517/1147833430 |
|---|
| 30 | zstyle ':completion:*:sudo:*' command-path /usr/local/sbin /usr/local/bin /usr/sbin /usr/bin /sbin /bin |
|---|
| 31 | |
|---|
| 32 | source $HOME/.zsh/aliases |
|---|
| 33 | source $HOME/.zsh/zshoptions |
|---|
| 34 | |
|---|
| 35 | # |
|---|
| 36 | # Default shell configuration |
|---|
| 37 | # |
|---|
| 38 | autoload -U colors |
|---|
| 39 | colors |
|---|
| 40 | autoload -U compinit |
|---|
| 41 | compinit |
|---|
| 42 | autoload predict-on |
|---|
| 43 | predict-on |
|---|
| 44 | |
|---|
| 45 | # http://nijino.homelinux.net/diary/200206.shtml#200206140 |
|---|
| 46 | |
|---|
| 47 | if [ "$TERM" = "screen-bce" ]; then |
|---|
| 48 | chpwd () { echo -n "_`dirs`\\" && ls} |
|---|
| 49 | preexec() { |
|---|
| 50 | # see [zsh-workers:13180] |
|---|
| 51 | # http://www.zsh.org/mla/workers/2000/msg03993.html |
|---|
| 52 | emulate -L zsh |
|---|
| 53 | local -a cmd; cmd=(${(z)2}) |
|---|
| 54 | case $cmd[1] in |
|---|
| 55 | fg) |
|---|
| 56 | if (( $#cmd == 1 )); then |
|---|
| 57 | cmd=(builtin jobs -l %+) |
|---|
| 58 | else |
|---|
| 59 | cmd=(builtin jobs -l $cmd[2]) |
|---|
| 60 | fi |
|---|
| 61 | ;; |
|---|
| 62 | %*) |
|---|
| 63 | cmd=(builtin jobs -l $cmd[1]) |
|---|
| 64 | ;; |
|---|
| 65 | cd) |
|---|
| 66 | if (( $#cmd == 2)); then |
|---|
| 67 | cmd[1]=$cmd[2] |
|---|
| 68 | fi |
|---|
| 69 | ;& |
|---|
| 70 | *) |
|---|
| 71 | echo -n "k$cmd[1]:t\\" |
|---|
| 72 | return |
|---|
| 73 | ;; |
|---|
| 74 | esac |
|---|
| 75 | |
|---|
| 76 | local -A jt; jt=(${(kv)jobtexts}) |
|---|
| 77 | |
|---|
| 78 | $cmd >>(read num rest |
|---|
| 79 | cmd=(${(z)${(e):-\$jt$num}}) |
|---|
| 80 | echo -n "k$cmd[1]:t\\") 2>/dev/null |
|---|
| 81 | } |
|---|
| 82 | chpwd |
|---|
| 83 | fi |
|---|