-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.zshrc
143 lines (125 loc) · 5.56 KB
/
.zshrc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
# (d) is default on
# ------------------------------
# General Settings
# ------------------------------
export EDITOR=vim # エディタをvimに設定
export LANG=ja_JP.UTF-8 # 文字コードをUTF-8に設定
export KCODE=u # KCODEにUTF-8を設定
export AUTOFEATURE=true # autotestでfeatureを動かす
bindkey -v # キーバインドをviモードに設定
setopt auto_pushd # cd時にディレクトリスタックにpushdする
#setopt correct # コマンドのスペルを訂正する
setopt prompt_subst # プロンプト定義内で変数置換やコマンド置換を扱う
setopt notify # バックグラウンドジョブの状態変化を即時報告する
#setopt equals # =commandを`which command`と同じ処理にする
### Complement ###
autoload -U compinit; compinit # 補完機能を有効にする
setopt auto_list # 補完候補を一覧で表示する(d)
setopt auto_menu # 補完キー連打で補完候補を順に表示する(d)
setopt list_packed # 補完候補をできるだけ詰めて表示する
setopt list_types # 補完候補にファイルの種類も表示する
bindkey "^[[Z" reverse-menu-complete # Shift-Tabで補完候補を逆順する("\e[Z"でも動作する)
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}' # 補完時に大文字小文字を区別しない
### History ###
HISTFILE=~/.zsh_history # ヒストリを保存するファイル
HISTSIZE=10000 # メモリに保存されるヒストリの件数
SAVEHIST=10000 # 保存されるヒストリの件数
setopt bang_hist # !を使ったヒストリ展開を行う(d)
setopt extended_history # ヒストリに実行時間も保存する
setopt hist_ignore_dups # 直前と同じコマンドはヒストリに追加しない
setopt share_history # 他のシェルのヒストリをリアルタイムで共有する
setopt hist_reduce_blanks # 余分なスペースを削除してヒストリに保存する
# マッチしたコマンドのヒストリを表示できるようにする
autoload history-search-end
zle -N history-beginning-search-backward-end history-search-end
zle -N history-beginning-search-forward-end history-search-end
bindkey "^P" history-beginning-search-backward-end
bindkey "^N" history-beginning-search-forward-end
# すべてのヒストリを表示する
function history-all { history -E 1 }
# ------------------------------
# Look And Feel Settings
# ------------------------------
### Ls Color ###
# 色の設定
export LSCOLORS=Exfxcxdxbxegedabagacad
# 補完時の色の設定
export LS_COLORS='di=01;34:ln=01;35:so=01;32:ex=01;31:bd=46;34:cd=43;34:su=41;30:sg=46;30:tw=42;30:ow=43;30'
# ZLS_COLORSとは?
export ZLS_COLORS=$LS_COLORS
# lsコマンド時、自動で色がつく(ls -Gのようなもの?)
export CLICOLOR=true
# 補完候補に色を付ける
zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS}
### Prompt ###
# プロンプトに色を付ける
autoload -U colors; colors
# 一般ユーザ時
tmp_prompt="%F{cyan}[%n@%D{%m/%d %T}]%f "
#tmp_prompt="%{${fg[cyan]}%}%n%# %{${reset_color}%}"
tmp_prompt2="%{${fg[cyan]}%}%_> %{${reset_color}%}"
tmp_rprompt="%{${fg[green]}%}[%~]%{${reset_color}%}"
tmp_sprompt="%{${fg[yellow]}%}%r is correct? [Yes, No, Abort, Edit]:%{${reset_color}%}"
# rootユーザ時(太字にし、アンダーバーをつける)
if [ ${UID} -eq 0 ]; then
tmp_prompt="%B%U${tmp_prompt}%u%b"
tmp_prompt2="%B%U${tmp_prompt2}%u%b"
tmp_rprompt="%B%U${tmp_rprompt}%u%b"
tmp_sprompt="%B%U${tmp_sprompt}%u%b"
fi
PROMPT=$tmp_prompt # 通常のプロンプト
PROMPT2=$tmp_prompt2 # セカンダリのプロンプト(コマンドが2行以上の時に表示される)
RPROMPT=$tmp_rprompt # 右側のプロンプト
SPROMPT=$tmp_sprompt # スペル訂正用プロンプト
# SSHログイン時のプロンプト
[ -n "${REMOTEHOST}${SSH_CONNECTION}" ] &&
PROMPT="%{${fg[white]}%}${HOST%%.*} ${PROMPT}"
;
#Title
precmd() {
[[ -t 1 ]] || return
case $TERM in
*xterm*|rxvt|(dt|k|E)term)
print -Pn "\e]2;[%~]\a"
;;
# screen)
# #print -Pn "\e]0;[%n@%m %~] [%l]\a"
# print -Pn "\e]0;[%n@%m %~]\a"
# ;;
esac
}
# ------------------------------
# Other Settings
# ------------------------------
### Aliases ###
#時刻を表示させる
alias history='history -E'
#Chromeで開く
#alias openc="open -a /アプリケーション/Google Chrome.app"
# cdコマンド実行後、lsを実行する
function cd() {
builtin cd $@ && ls;
}
#tex関連
export PATH="/Applications/UpTeX.app/teTeX/bin:$PATH"
function tex(){
FILESTRING=$1
FILENAME=${FILESTRING%.*}
VAR=`nkf -g ${FILENAME}.tex`
if [ "${VAR}" = "Shift_JIS" ]; then
platex -kanji=sjis ${FILENAME}.tex
jbibtex -kanji=sjis ${FILENAME}
platex -kanji=sjis ${FILENAME}.tex
platex -kanji=sjis ${FILENAME}.tex
dvipdfmx ${FILENAME}.dvi
open ${FILENAME}.pdf
elif [ "${VAR}" = "EUC-JP" ]; then
platex -kanji=euc ${FILENAME}.tex
jbibtex -kanji=euc ${FILENAME}
platex -kanji=euc ${FILENAME}.tex
platex -kanji=euc ${FILENAME}.tex
dvipdfmx ${FILENAME}.dvi
open ${FILENAME}.pdf
fi
echo ${VAR}
}