root/dotfiles/zsh/oinume/.zshrc

Revision 22994, 15.1 kB (checked in by oinume, 2 weeks ago)

[dotfiles/zsh/oinume] zsh 4.3.6だとエラーになる問題を修正

Line 
1############ -*- Mode: shell-script; coding: euc-jp -*- ####
2# ~ippei/.zshrc
3#   written by ippei.kishida@materials.mbox.media.kyoto-u.ac.jp
4# last modified : 2004-08-02
5# �������������۲��Ǥ�
6# cf: man zshall, zshoptions
7############################################################
8#### ɾ��ѥ��ڡ���
9#autoload -U predict-on # ���ޥ���¬��(�ҥ��ȥꢪ�����)
10#zle -N predict-on
11#zle -N predict-off
12#bindkey '^Xp' predict-on    # [C-x p] �����bindkey '^X^p' predict-off  # [C-x C-p] �����predict-on
13# ��������ɡ����ޥ�饤��������Խ��������˥��������ߤ���ƾä�������
14# PROMPT��
15if [ "$TERM" = "screen" ]; then
16  preexec() {
17    # see [zsh-workers:13180]
18    # http://www.zsh.org/mla/workers/2000/msg03993.html
19    emulate -L zsh
20    local -a cmd; cmd=(${(z)2})
21    host=`hostname`
22    echo -n "k$host:$cmd[1]:t\\"
23  }   
24fi
25#function ssh_screen(){
26#  server=''
27#  for arg in $@; do
28#    server=$arg
29#  done
30#  eval server="${$#}"
31#  screen -t $server ssh "$@"
32#}
33#if [ x$TERM = xscreen ]; then
34#   alias ssh=ssh_screen
35#fi
36
37
38autoload -U zmv
39# % zmv '(*).jpeg' '$1.jpg'
40# % zmv '(**/)foo(*).jpeg' '$1bar$2.jpg'
41# % zmv -n '(**/)foo(*).jpeg' '$1bar$2.jpg' # �¹Ԥ����ѥ�������Τ�# % zmv '(*)' '${(L)1}; # �ʸ��ʸ�� zmv -W '*.c.org' 'org/*.c' #��*)�ס�1�פ��פǺѤޤ�����lias mmv='noglob zmv -W'  # ���������Ȥ���ʤΤ�# % mmv *.c.org org/*.c
42#zmv -C # ����ǤϤʤ����ԡ�(zcp �Ȥ��ƻȤ��ˡ�⤢�����������
43#zmv -L # ����ǤϤʤ�����(zln �Ȥ��ƻȤ��ˡ�⤢�����������
44
45zstyle ':completion:*' use-compctl false # compctl�����Ѥ��ʤ�
46
47# �ǥե����Ǥ�����̾��/etc/passwd ���顢�ۥ������/etc/hosts ����������äƤ���zstyle ':completion:*' users-hosts bar:foo.example.com funa@daemon
48 
49############################################################
50# tcsh �̣�������h-backward-delete-word () {
51    #local WORDCHARS="${WORDCHARS:s#/#}"
52    #zle backward-delete-word
53#}
54#zle -N tcsh-backward-delete-word # �ؿ�widget ��Ѥ���#bindkey '^W' tcsh-backward-delete-word # bindkey �dz��Ƥ�# ñ���̤ǤΥХå����ڡ���
55#export WORDCHARS='*?_.[]~=&;!#$%^(){}<>'
56#bindkey "^[h" backward-kill-word
57
58# redo
59
60#     $ bindkey G backward-kill-word
61#     "^W" backward-kill-word
62#     "^[^H" backward-kill-word
63#     "^[^?" backward-kill-word
64
65# ��
66# cd -[tab] �ǥǥ��쥯�ȥꥹ���å���ӽФ��� <1-20> �ѥ�����å�# ESC C-h �Ƕ������ΥХå����ڡ���
67# killall���ޥ�# ***/ �����󥯤�� C-x g �磻���������������� a=aiueo; echo $a[1] # ���ΰ���
68# setopt multios(�ǥե���)��������쥯�ȡ��ѥ�����s > 1.txt > 2.txt | less��
69
70#### �ʲ��˽񤫤��ʤ������Х����man zshzle ��STANDARD WIDGETS �򻲾�# ESC-q (push-line)�ǥ��쥯�ȥꥹ���å�
71# C-x C-x       (exchange-point-and-mark)C-SPACE �ǥޡ��������Ľ�������# ESC-T (transpose-words)�������
72# ESC-. (insert-last-word)ľ����ޥ�κǸ����ƤӽФ�(�������Ȥ�����Ķ�������
73# ESC-U (up-case-word)�������������콪ü�ޤǤ������
74# ESC-L (down-case-word)�������������콪ü�ޤǤ������
75# ESC-' (quote-line)���ޥ������� �dz�
76# ESC-" (quote-region)�ޡ���������֡������������ �dz�
77# (̤����      (expand-cmd-path)���ޥ����������
78# C-x C-=       (what-cursor-position)����������ˤ������ɤ�10��16�������������������
79# C-[   ESC ��� ESC-n (digit-argument)�������β���㡧[ESC-4][ESC-0]-)
80# ESC C-_       (copy-prev-word)�����������ˤ��������ԡ����ƥڡ����Ȥ��� C-x C-o       (overwrite-mode)���������Υ⡼��ڤ���
81
82# �Ŀ�������Х���˻Ȥ���-�����Х���# C-o, C-q, C-s
83# C-c, C-g ������Υ��ޥ���ä��Ƥ��ޤ��Τ򲿤Ȥ����� C-i   TAB �Ǥ���
84# C-w   ����
85# C-v   ���������C-v C-i �ʤ饿�����v C-j �ʤ���������� C-x �ϥ��ޥ��٤롣(C-x g �ߤ�����
86# ��C-t ����������ϻȤ����꤬����ʤ��ΤǤ����� �� screen �˻��#### C-j or C-m �ɤ�餫��ɤ������櫓�ǤϤʤ���skkinput ��C-j ���
87
88#### �᡼�����å�
89## autoload -U colors; colors   # ���Τ����������Ƥʤ������Ƥ���
90# MAILCHECK=300                 # 300���˥���å�
91## MAILPATH="/var/mail$USER"    # ����å����������å���
92# MAILPATH="/var/mail$USER?{fg[red]}New mail"   # ���������ȿ����
93
94## --enable-maildir-support ��ꤷ�ƥ�����뤹��Maildir ����Ǥ�ǽ
95# MAILPATH="$HOME/Maildir?{fg_bold[red]}New mail in $_" # ��_�פ�ѹ����줿file
96## : �Ƕ���ʣ��᡼�륹�ס�������å��Ǥ��� MAILPATH="$HOME/Maildir?{fg_bold[red]}New mail in $_:$HOME/Maildir-foo?{fg_bold[green]}New mail in $_:"
97
98############################################################
99# �Ķ����� ~/.zshenv �˵���# ~/.zshrc �˵��Ҥ����ϡ����󥿥饯�ƥ��֥��������Ƥ���# ���κ�粽����ʤ��ʤ�����
100#if [ ! $TERM = "screen"  ]; then; screen; fi
101
102autoload -U colors; colors      # ${fg[red]}����Υ��顼�񼰤��hosts=( localhost `hostname` )
103#printers=( lw ph clw )
104umask 002
105cdpath=( ~ )                    # cd �Υ�����ѥ�
106#fpath=($fpath ~/.zfunc )       # zsh�ؿ������ѥ�
107
108# �����ȥǥ��쥯�ȥ�����ʤ����Τ�cdpath ���ǥ��쥯�ȥ���zstyle ':completion:*:cd:*' tag-order local-directories path-directories
109# cf. zstyle ':completion:*:path-directories' hidden true
110# cf. cdpath ���ǥ��쥯�ȥ��������鳰��
111
112## �������羮ʸ������ʤ�
113zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}'
114
115#### history
116HISTFILE="$HOME/.zhistory"      # ���ե�����ISTSIZE=10000           # ������������ $HISTFILE �κ�祵������
117SAVEHIST=10000                  # �¸����������### option, limit, bindkey
118setopt extended_history         # ���ޥ�γ��ϻ����в��֤��
119setopt hist_ignore_dups         # ľ��Υ��ޥ��������Ͽ���ʤ�
120setopt hist_ignore_all_dups     # �Ͽ�ѥ��ޥ�ԤϸŤ�����pt hist_reduce_blanks # ;ʬ�ʶ�ϵͤ��Ͽ(�����Ͽ���)
121#setopt append_history  # zsh ������������ե�������Ͽ(�ǥե���)
122#setopt inc_append_history # Ʊ�塢��������ޥ��Ϥ�������ǵ�Ͽ
123setopt share_history    # �ҥ��ȥ���ͭ��(append�ϤȰۤʤ���߹����ס����������� append �Ϥ���
124setopt hist_no_store            # history���ޥ�������ʤ�
125setopt hist_ignore_space # ���ޥ�������λ��Ͽ���ʤ�(ľ�����Ƥ٤�setopt auto_pushd               
126setopt no_auto_menu             # ���������ab, Ctrl+I) ��Ǥ������ǽ����������䴰����̵��
127setopt list_packed              # �����ꥹ�Ȥ��ɽ��
128setopt print_eight_bit          # �����ꥹ�Ȥ����ɽ��
129#setopt menu_complete  # 1���AB ��䴰������ɽ���������
130#setopt no_clobber               # ���������쥯�Ȥζػ�setopt no_unset                 # ̤���ѿ��Ѥζػ�setopt no_hup                   # logout���˥Хå����饦�������ll ���ʤ�
131#setopt no_beep                  # ���ޥ������顼��EEP��餵�ʤ�
132
133setopt extended_glob            # �������
134setopt numeric_glob_sort        # ���ͤȲ���ƾ��祽���Ȥǽ��setopt auto_cd                  # �1���ǥ��쥯�ȥ���cd ���
135#setopt correct                  # ���ڥ������
136setopt no_checkjobs             # exit ���˥Хå����饦�����������ʤ�
137setopt ignore_eof              # C-d��ogout���ʤ�(C-d����ǻȤ����
138setopt pushd_to_home        # ����pushd��HOME���(ľ�dir�ؤ�cd - ��
139setopt pushd_ignore_dups        # �ǥ��쥯�ȥꥹ���å��˽�������ϸŤ�����opt pushd_silent   # pushd, popd ��٤˥ǥ��쥯�ȥꥹ���å����������ʤ�
140setopt interactive_comments     # ���ޥ�����Υ����Ȥ��
141#setopt rm_star_silent          # rm * ����ɤ���ʹ�����˼¹�#setopt rm_star_wait            # rm * �λ���10��ֲ��⤷�ʤ�
142#setopt chase_links             # ������Υѥ���Ѵ����Ƥ����ԡ�
143# setopt sun_keyboard_hack      # SUN�����ܡ��ɤǤ�ѽ�typo ` �򥫥С�����
144#limit   coredumpsize    0       # �����ե���������ʤ��褦�ˤ���stty    erase   '^H'
145stty    intr    '^C'
146stty    susp    '^Z'
147
148#### bindkey
149# bindkey "���Ƥ�������" �¹Ԥ����뵡ǽ����
150bindkey -e    # emacs ������Х����Ķ����ITOR ���Ǥ��뤬�����ä��ͥ�)
151bindkey '^I'    complete-word   # complete on tab, leave expansion to _expand
152bindkey "^?" backward-delete-char # backspace�Ǻ�
153bindkey '^P' history-beginning-search-backward # �Ƭ�ޥå�Υҥ��ȥꥵ����bindkey '^N' history-beginning-search-forward # �Ƭ�ޥå�Υҥ��ȥꥵ����
154# tcsh��Ƭ�ޥå�Υҥ��ȥꥵ�����������뤬��� ���Ȼפ������������������뤳�Ȥ�����������C-e �Ǥ�����٤뤷
155#autoload history-search-end
156# zle -N history-beginning-search-backward-end history-search-end
157# zle -N history-beginning-search-forward-end history-search-end
158# bindkey "^P" history-beginning-search-backward-end
159# bindkey "^N" history-beginning-search-forward-end
160
161# run-help ���ƤФ줿����zsh ������ޥ�ξ��ϳ������sh �Υޥ˥奢����
162[ -n "`alias run-help`" ] && unalias run-help
163autoload run-help
164
165#### completion
166#_cache_hosts=(`perl -ne  'if (/^([a-zA-Z0-9.-]+)/) { print "$1\n";}' ~/.ssh/known_hosts`)
167# ��(_cache_hosts) ~/.ssh/known_hosts ���鼫ưŪ�˼�����cache_hosts=($HOST localhost)
168autoload -U compinit; compinit -u
169compdef _tex platex             # platex ��.tex ��############################################################
170## �ץ��ץ���nsetopt promptcr       # ���ԤΤʤ���Ϥ���ץȤǾ����������
171setopt prompt_subst             # ESC���������פ����#if [ $TERM = "kterm-color" ] || [ $TERM = "xterm" ]; then
172if [ $COLORTERM = 1 ]; then
173  if [ $UID = 0 ] ; then
174    PSCOLOR='00;04;31'  # �ٻ��;�
175  else
176    PSCOLOR='00;04;32'  # �ٻ��;�
177  fi
178#    RPROMPT=$'%{\e[${PSCOLOR}m%}[%~]%{\e[00m%}'        # ���ץ��ץ�  RPS1=$'%{\e[${PSCOLOR}m%}[%~]%{\e[00m%}'      # ���ץ��ץ�  PS1=$'%{\e]2; %m:%~ \a'$'\e]1;%%: %~\a%}'$'\n%{\e[${PSCOLOR}m%}%n@%m ${WINDOW:+"[$WINDOW]"}%#%{\e[00m%} '
179fi
180# 1��ܤ�$'...' ����e]2;��term �Υ����ȥ�\a��# 2��ܤ�$'...' ����e]1;�֥�����������ȥ�\a��# 3��ܤ�$'...' ���ץ��ץ�
181# \e ��C ������)��֤�ɬ������뤫�� emacs �Ǥ�C-q ESC, vi �Ǥ�C-v ESC ��������       \e[00m  �����#       \e[01m  ��� (0�Ͼ������äݤ�)
182#       \e[04m  ������饤��      \e[05m  blink(���      \e[07m  ȿž
183#       \e[3?m  ʸ��������       \e[4?m  ��ʿ��򤫤���               ?= 0:��:�, 2:�, 3:��, 4:�, 5:��6:��:�
184
185############################################################
186## alias & function
187
188#### PAGER
189alias less="$PAGER"
190alias m="$PAGER"
191alias -g L="| $PAGER"
192alias -g M="| $PAGER"
193alias les="less"        # for typo
194
195#### emacs
196if [ -x $HOME/bin/select-emacs ]; then
197  alias emacs='$HOME/bin/select-emacs'
198  alias emasc='$HOME/bin/select-emacs'
199fi
200
201#### ps
202if [ $ARCHI = "irix" ]; then
203  alias psa='ps -ef'
204else;
205  alias psa='ps auxw'
206fi
207function pst() {                # CPU �����ι⤤������  psa | head -n 1
208  psa | sort -r -n +2 | grep -v "ps -auxww" | grep -v grep | head -n 8
209}
210function psm() {                # ����ͭΨ�ι⤤������  psa | head -n 1
211  psa | sort -r -n +3 | grep -v "ps -auxww" | grep -v grep | head -n 8
212}
213function psg() {
214  psa | head -n 1
215  psa | grep $* | grep -v "ps -auxww" | grep -v grep
216}
217
218#### ls
219#### dircolor
220if [ -x /usr/bin/dircolors ] && [ -e $HOME/.dircolors ]; then
221  eval `dircolors $HOME/.dircolors` # ������i
222if [ $ARCHI = "linux" ]; then
223  alias ls="ls -F --color=auto --show-control-char"
224  alias lscolor='ls -F --color=always --show-control-char'
225  # ����ꥹ�Ȥ򥫥顼��
226  zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS}
227else
228  alias ls="ls -F"
229  alias lscolor='ls -F'
230fi
231alias kls='ls'
232alias qls='ls' # Shift-PageUp ������ˤĤ� q ��äƤ��ޤ��Τ��ias sl='ls'
233alias s='ls'
234alias lf='ls'
235alias l='ls'
236alias la='ls -a'
237alias ll='ls -al'
238alias lh='ls -lh'
239function lsl() { lscolor $* | less }
240function lll() { lscolor -la $* | less }
241
242#### command
243alias du='du -k'
244alias mv='mv -iv'
245#alias  memo    'skkfep -viesc -e jvim3 ~/memo.txt'
246function kterm() { /usr/X11R6/bin/kterm -sb -sl 500 -km euc -title kterm@$HOST $* & }
247function mlterm() { /usr/X11R6/bin/mlterm $* & }
248#alias mnews='mnews -m'
249alias xcalc='xcalc &'
250alias xterm='xterm &'
251alias w3m='w3m -X'
252alias xinit='ssh-agent xinit'
253alias bell="echo '\a'"
254alias scr="screen -R"
255
256# short name
257alias h='head'
258alias t='tail'
259alias g='grep'
260alias c='cat'
261alias j='jobs'
262#alias w='wc'   w ��w �Τޤ޻Ȥ���
263
264## global alias
265alias -g H='| head'
266alias -g T='| tail'
267alias -g G='| grep'
268alias -g C='| cat -n'
269alias -g W='| wc'
270#alias -g S='| sed'
271#alias -g A='| awk'
272alias -g ....='../..'
273
274function cd() { builtin cd $@ }
275alias cd..='cd ..'
276alias cd../='cd ..'
277function gv() { command gv $* & }
278function gimp() { command gimp $* & }
279function mozzila() { command mozilla $* & }
280function xdvi() { command xdvi $* & }
281function mpg321() { command mpg321 -s $* | esdcat & }
282#function h() { history $* | head -29 | less }
283#alias cp='cp -iv'
284
285function rm() {
286  if [ -d ~/.trash ]; then
287    local DATE=`date "+%y%m%d-%H%M%S"`
288    mkdir ~/.trash/$DATE
289    for i in $@; do
290      # ��ݤ� ~/.trash/ �ʲ��ʥե������� /bin/rm ��ӽФ�������      if [ -e $i ]; then
291        mv $i ~/.trash/$DATE/
292      else
293        echo "$i : not found"
294      fi
295    done
296  else
297    /bin/rm $@
298  fi
299}
300
301function euc() {                # ʸ���ɤ�c-jp ��Ѵ�
302  for i in $@; do;
303    nkf -e -Lu $i >! /tmp/euc.$$ # -Lu :���Ԥ� �ˤ���   mv -f /tmp/euc.$$ $i
304  done;
305}
306
307function sjis() {               # ʸ���ɤ�ift-jis ��Ѵ�
308  for i in $@; do;
309    nkf -s -Lw $i >! /tmp/euc.$$ # -Lu :���Ԥ�LF �ˤ���   mv -f /tmp/euc.$$ $i
310  done;
311}
312
313function google() {
314  local str opt
315  if [ $# != 0 ]; then # ��¸�ߤ���
316    for i in $*; do
317      str="$str+$i"
318    done   
319    str=`echo $str | sed 's/^\+//'` #�Ƭ�Ρ��פ��opt='search?num=50&hl=ja&ie=euc-jp&oe=euc-jp&lr=lang_ja'
320    opt="${opt}&q=${str}"
321  fi
322  w3m http://www.google.co.jp/$opt #���ʤ��� $opt �϶�ʤ� # mozilla -remote openURL\(http::/www.google.co.jp/$opt\) # ̤�ƥ���}
323alias ggl=google
324
325#### time
326REPORTTIME=15                    # CPU��ðʾ��ä�����time ���
327TIMEFMT="\
328    The name of this job.             :%J
329    CPU seconds spent in user mode.   :%U
330    CPU seconds spent in kernel mode. :%S
331    Elapsed time in seconds.          :%E
332    The  CPU percentage.              :%P"
333
334#### �����ƻ� log ���ޥ�Ǥ���򸫤뤳�Ȥ��Ǥ���atch=(notme) # (all:���otme:��ʬ�ʳ����桼��̾,@�ۥ������%ü�̾
335              # (��󡨶���ꡢ�Ҥ��ƽ񤯤�ND��
336LOGCHECK=60                     # ����å��ֳ��]
337WATCHFMT="%(a:${fg[blue]}Hello %n [%m] [%t]:${fg[red]}Bye %n [%m] [%t])"
338# ���Ǥϡ�a (����󤫥�����Ȥ�)�Ǿ����Ƥ��� %(a:���Υ�������:���Υ�������)
339# a,l,n,m,M ������롣
340# ���Ȥ�������n    �桼��̾
341# %a    ������������Ȥ˱����ơ�ogged on����ogged off��# %l    �����Ƥ����̾
342# %M    Ĺ���ۥ����
343# %m    û���ۥ����
344# %S��s        ��δ֤��
345# %U��u        ��δ֤򥢥���饤��%B��b        ��δ֤��t,%@ 12��������λ���# %T    24��������λ���# %w    ��(�� �)
346# %W    ��(���# %D    ��(ǯ-���###########################################################
347## �Ŀ;����
348if [ -e ~/.zshrc_private ]; then
349  source ~/.zshrc_private
350fi
351#### end of ~ippei/.zshrc #########################################
Note: See TracBrowser for help on using the browser.