-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy path.zshrc
224 lines (183 loc) · 5.6 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
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
# -*- sh-shell: zsh; -*-
[[ "$MY_ZSHENV" = MY_ZSHENV ]] && . ~/.zshenv
bindkey -e
setopt auto_cd
setopt auto_pushd
setopt pushd_ignore_dups
setopt extended_glob
setopt noautoremoveslash
setopt correct
setopt list_packed
setopt nolistbeep
setopt auto_param_keys
setopt auto_param_slash
setopt complete_aliases
setopt numeric_glob_sort
setopt equals
setopt magic_equal_subst
HISTFILE=$HOME/.zsh_history
HISTSIZE=1000000
SAVEHIST=1000000
setopt hist_ignore_space
setopt share_history
setopt extended_history
zstyle ':completion:*' list-colors 'di=34' 'ln=35' 'so=32' 'ex=31' 'bd=46;34' 'cd=43;34'
case "${OSTYPE}" in
freebsd*|darwin*)
if [ $(which ls | grep gnubin) ]
then
ls=coreutils
else
ls=bsdls
fi
;;
linux*)
ls=coreutils
;;
esac
# 環境に合わせて出来るだけ好みのls出力にする
# http://qiita.com/kawaz/items/a44f42bd5099efaab431
if [ "$ls" = "bsdls" ]; then
alias ls='ls -G -w'
elif ls -d -N >/dev/null 2>&1; then
# 最近の gnubin/ls が勝手にファイル名をクオート出力してくるのを抑止
alias ls='ls --color --time-style +%Y-%m-%d\ %H:%M:%S.%3N -N'
elif ls -d --time-style +%Y-%m-%d\ %H:%M:%S.%3N >/dev/null 2>&1; then
# デフォの時間表示は見難いのでISOぽくする(full-iso,long-iso,isoは帯に短し襷に長しなのでカスタム)
alias ls='ls --color --time-style +%Y-%m-%d\ %H:%M:%S.%3N'
elif ls -d --color >/dev/null 2>&1; then
# せめて色だけでも…
alias ls='ls --color'
fi
autoload colors && colors
fpath=(
$HOME/local/zsh/completions(N-/)
$HOME/local/zsh/functions(N-/)
$fpath
)
case ${UID} in
0)
PROMPT="%{${fg[blue]}%}%n%{${reset_color}%} %{${fg[blue]}%}#%{${reset_color}%} "
PROMPT2="%B%{${fg[blue]}%}%_#%{${reset_color}%}%b "
SPROMPT="%B%{${fg[blue]}%}%r is correct? [n,y,a,e]:%{${reset_color}%}%b "
RPROMPT="%{${fg[blue]}%}[%/]%{${reset_color}%}"
;;
*)
PROMPT="%n %{${fg[blue]}%}%%%{${reset_color}%} "
PROMPT2="%B%{${fg[blue]}%}%_#%{${reset_color}%}%b "
SPROMPT="%B%{${fg[blue]}%}%r is correct? [n,y,a,e]:%{${reset_color}%}%b "
RPROMPT="%{${fg[blue]}%}[%/]%{${reset_color}%}"
;;
esac
case "${TERM}" in
screen)
TERM=xterm
;;
esac
case "${TERM}" in
xterm|xterm-color)
export LSCOLORS=exfxcxdxbxegedabagacad
export LS_COLORS='di=34:ln=35:so=32:pi=33:ex=31:bd=46;34:cd=43;34:su=41;30:sg=46;30:tw=42;30:ow=43;30'
zstyle ':completion:*' list-colors 'di=34' 'ln=35' 'so=32' 'ex=31' 'bd=46;34' 'cd=43;34'
;;
kterm-color)
stty erase '^H'
export LSCOLORS=exfxcxdxbxegedabagacad
export LS_COLORS='di=34:ln=35:so=32:pi=33:ex=31:bd=46;34:cd=43;34:su=41;30:sg=46;30:tw=42;30:ow=43;30'
zstyle ':completion:*' list-colors 'di=34' 'ln=35' 'so=32' 'ex=31' 'bd=46;34' 'cd=43;34'
;;
kterm)
stty erase '^H'
;;
cons25)
unset LANG
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'
zstyle ':completion:*' list-colors 'di=;34;1' 'ln=;35;1' 'so=;32;1' 'ex=31;1' 'bd=46;34' 'cd=43;34'
;;
jfbterm-color)
export LSCOLORS=gxFxCxdxBxegedabagacad
export LS_COLORS='di=01;36: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'
zstyle ':completion:*' list-colors 'di=;36;1' 'ln=;35;1' 'so=;32;1' 'ex=31;1' 'bd=46;34' 'cd=43;34'
;;
esac
case "${TERM}" in
xterm|xterm-color|kterm|kterm-color)
precmd() {
echo -ne "\033]0;${USER}@${HOST%%.*}:${PWD}\007"
}
;;
esac
if [[ -f /Applications/MacVim.app/Contents/MacOS/Vim ]]
then
alias vim=/Applications/MacVim.app/Contents/MacOS/Vim
fi
alias Emacs=$(which emacs)
if [[ -f /Applications/Emacs.app/Contents/MacOS/Emacs ]]
then
alias emacs="/Applications/Emacs.app/Contents/MacOS/Emacs -nw"
fi
if [[ -f /opt/homebrew/bin/brew ]]
then
eval $(/opt/homebrew/bin/brew shellenv)
fi
alias あ=ag
alias s=ls
alias be="bundle exec"
alias tmxu=tmux
alias tumx=tmux
alias Tree=$(which tree)
tree(){
command tree -C $* | less -R
}
jqless(){ cat ${1:--} | jq ${2:-.} -C | less -R }
if which xsel > /dev/null
then
alias pbcopy='xsel --clipboard --input'
alias pbpaste='xsel --clipboard --output'
fi
if which nproc > /dev/null
then
else
alias nproc='sysctl -n hw.ncpu'
fi
export RAILS_ENV=development
export MICRO_TRUECOLOR=1
export PHAN_BIN=$HOME/.composer/vendor/bin/phan
# iTerm2 shell integration
[[ -e "${HOME}/.iterm2_shell_integration.zsh" ]] && . "${HOME}/.iterm2_shell_integration.zsh"
[[ -e "${HOME}/pixiv/dev-script/init_nodenv" ]] && eval "$("${HOME}/pixiv/dev-script/init_nodenv" -)"
[[ -e "$HOME/local/dotfiles/ttcopy/ttcp_activate.sh" ]] && . "$HOME/local/dotfiles/ttcopy/ttcp_activate.sh"
phpstan() {
if [[ -f 'vendor/bin/phpstan' ]] ; then
'vendor/bin/phpstan' --memory-limit=2G "$@"
elif [[ -f "$(composer config bin-dir)/phpstan" ]] ; then
"$(composer config bin-dir)/phpstan" --memory-limit=2G "$@"
else
command phpstan --memory-limit=2G "$@"
fi
}
phptags(){
ctags -e --php-types=c+i+d+f $(git ls-files '*.php' | grep -v __snapshots__)
}
vld () {
php -dvld.active=1 -dvld.execute=0 "$@" 2>&1
}
if (which zprof > /dev/null) ;then
zprof | less
fi
autoload -U compinit && compinit
if (which pyenv > /dev/null) ;then
eval "$(pyenv init -)"
fi
if (which zoxide > /dev/null)
then
eval "$(zoxide init zsh)"
alias cd=z
fi
[ -n "$EAT_SHELL_INTEGRATION_DIR" ] && . $EAT_SHELL_INTEGRATION_DIR/zsh
# bun completions
[ -s "/Users/megurine/.bun/_bun" ] && source "/Users/megurine/.bun/_bun"
# Bun
export BUN_INSTALL="/Users/megurine/.bun"
export PATH="$BUN_INSTALL/bin:$PATH"