-
Notifications
You must be signed in to change notification settings - Fork 0
/
.zshrc
181 lines (155 loc) · 3.43 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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
#
# setting environmental variables
#
export LANG=ja_JP.UTF-8
export PATH="/usr/local/bin:$PATH"
#
# initializations
#
if type "rbenv" > /dev/null; then
eval "$(rbenv init -)"
fi
#
# setting completion
#
autoload -U compinit
compinit
# pack completion list
setopt list_packed
# auto sugestion
# autoload predict-on
# predict-on
# don't remove postfix slash
setopt noautoremoveslash
#
# setting PROMPTs
#
case ${UID} in
0)
# prompt_dir="%B%{[31m%}[%32<...<%~]%{[m%}%b"
prompt_dir="[%32<...<%~]"
prompt_time="%D{%T}"
prompt_user="%B%{[31m%}%n%{[m%}%b"
[ -n "${REMOTEHOST}${SSH_CONNECTION}" ] &&
prompt_user="${prompt_user}%B%{[37m%}@${HOST%%.*}%{[m%}%b"
PROMPT=$'\n'"["$prompt_user" "$prompt_time"]"$prompt_dir$'\n''%% '
RPROMPT=
PROMPT2="%B%{[31m%}%_>%{[m%}%b "
;;
*)
# prompt_dir="%B%{[34m%}[%32<...<%~]%{[m%}%b"
prompt_dir="[%32<...<%~]"
prompt_time="%D{%T}"
prompt_user="%B%{[34m%}%n%{[m%}%b"
# PROMPT="%B%{[34m%}_(┐「ε:)_%{[m%}%b "
[ -n "${REMOTEHOST}${SSH_CONNECTION}" ] &&
prompt_user="${prompt_user}%B%{[37m%}@${HOST%%.*}%{[m%}%b"
PROMPT=$'\n'"["$prompt_user" "$prompt_time"]"$prompt_dir$'\n''%% '
RPROMPT=
PROMPT2="%B%{[34m%}%_>%{[m%}%b "
;;
esac
#
# setting terminal title
#
case ${TERM} in
kterm*|xterm*)
precmd() {
echo -ne "\033]0;${USER}@${HOST%%.*}:${PWD}\007"
}
;;
esac
#
# setting histry
#
HISTFILE=~/.zsh_history
HISTSIZE=10000
SAVEHIST=10000
# ignore duplication command history list
setopt hist_ignore_dups
# share command history data
setopt share_history
#
# setting search keybind
#
bindkey -e
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
#
# setting about cd
#
setopt auto_cd
setopt auto_pushd
#
# setting command corrent
#
setopt correct
# invalidate beep sound
setopt nolistbeep
#
# setting lscolors
#
# export LSCOLORS=exfxcxdxbxegedabagacad
export LSCOLORS=ExFxCxdxBxegedabagacad
case ${OSTYPE} in
freebsd*|darwin*)
alias ls="ls -G -w"
;;
linux*)
alias ls="ls --color"
;;
esac
# completion colors
# zstyle ':completion:*' list-colors 'di=34' 'ln=35' 'so=32' 'ex=31' 'bd=46;34' 'cd=43;34'
zstyle ':completion:*' list-colors 'di=;34;1' 'ln=;35;1' 'so=;32;1' 'ex=31;1' 'bd=46;34' 'cd=43;34'
# using when writing each environment's settings
# [ -f ~/.zshrc.mine ] && source ~/.zshrc.mine
#
# settin aliases
#
setopt complete_aliases
alias where="command -v"
alias j="jobs -l"
alias la="ls -a"
alias lf="ls -F"
alias ll="ls -l"
alias du="du -h"
alias df="df -h"
alias su="su -l"
alias cdb="cd .."
# tmux
alias tm='tmux'
alias tma='tmux attach'
alias tml='tmux list-window'
alias memo="vim $HOME/.worktrace"
alias nave=$HOME/.nave/nave.sh
alias SimMips="$HOME/carchs/work/SimMips-0.5.5/SimMips"
#
# quick executers
#
alias -s c=zsh_c_executer
alias -s rb=ruby
zsh_c_executer()
{
gcc ${@+"$@"}
./a.out
}
#
# show git branch
#
autoload -Uz vcs_info
zstyle ':vcs_info;*' formats '[%b]'
zstyle ':vcs_info;*' actionformats '[%b|%a]'
precmd () {
psvar=()
LANG=en_US.UTF-8 vcs_info
[[ -n "$vcs_info_msg_0_" ]] && psvar[1]="$vcs_info_msg_0_"
}
RPROMPT="%1(v|%F{green}%1v%f|)"$RPROMPT
[ -d ~/.zsh ] && source ~/.zsh/*
# pong the notification
alias pong='perl -nle '\''print "display notification \"$_\" with title \"Terminal\""'\'' | osascript'
source $HOME/.zshenv