-
Notifications
You must be signed in to change notification settings - Fork 0
/
.zshrc
147 lines (123 loc) · 3.7 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
# Operations
#------------------
# ZLE は emacs モード。vi モードはまだ慣れないので
# fzf がキーバインドを設定する前に読み込むこと
bindkey -e
# for safe redirect
set -o noclobber
# completions
autoload -Uz compinit && compinit
zstyle ':completion:*' use-cache yes
zstyle ':completion:*:default' menu select=2
zstyle ':completion::complete:make:*:targets' call-command true
source <(docker completion zsh)
# word split chars
# ctrl-w などの動作に影響する
autoload -Uz select-word-style
select-word-style default
zstyle ':zle:*' word-chars ' /=;:@{}[]()<>,.|'
zstyle ':zle:*' word-style unspecified
# Histories
#------------------
export HISTFILE=${HOME}/.zsh_history
export HISTSIZE=1000
export SAVEHIST=100000
setopt extended_history
setopt hist_ignore_dups
setopt hist_ignore_all_dups
setopt hist_ignore_space
setopt hist_reduce_blanks
setopt hist_expire_dups_first
setopt hist_save_no_dups
# 複数端末感での共有とタイムスタンプ
setopt share_history
# **envs
#------------------
# homebrew
if [ -x /opt/homebrew/bin/brew ]; then
eval "$(/opt/homebrew/bin/brew shellenv)"
fi
# direnv
eval "$(direnv hook zsh)"
# anyenv
type anyenv &>/dev/null && eval "$(anyenv init -)"
# NOTE: anyenv を使う環境は ~/.anyenv/envs に、そうでない環境は $HOME に配置される想定
# rbenv
if [ -d ~/.rbenv ]; then
export PATH="$HOME/.rbenv/bin:$HOME/.rbenv/shims:$PATH"
function rbenv() {
unset -f rbenv
eval "$(command rbenv init -)"
rbenv "$@"
}
fi
# nodenv
if [ -d ~/.nodenv ]; then
export PATH="$HOME/.nodenv/bin:$HOME/.nodenv/shims:$PATH"
function nodenv() {
unset -f nodenv
eval "$(command nodenv init -)"
nodenv "$@"
}
fi
# pyenv
if [ -d ~/.pyenv ]; then
export PATH="$HOME/.pyenv/bin:$HOME/.pyenv/shims:$PATH"
function pyenv() {
unset -f pyenv
eval "$(command pyenv init -)"
pyenv "$@"
}
fi
# rust
if [ -d ~/.cargo ]; then
source $HOME/.cargo/env
fi
# Functions
#------------------
movtogif() {
ffmpeg -i "$1" -vf scale=800:-1 -r 10 -f image2pipe -vcodec ppm - |
convert -delay 10 -layers Optimize -loop 0 - "${1%.*}.gif"
}
# OSX 固有
if [ $(uname) = "Darwin" ]; then
# 任意のコマンドが終わったら通知
display_notification() {
$*
tput bel
osascript -e 'display notification "Processes are done." with title "Back To Working!"'
}
alias dn=display_notification
mute_volume() {
osascript -e "set volume output muted true"
osascript -e "get volume settings"
}
alias vmute=mute_volume
alias ssaver='open -a ScreenSaverEngine'
fi
# Sources
#------------------
# export する環境変数を読み込む
source ~/.zsh/.exports.zsh
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
# プラグインマネージャ
[ -d ~/.oh-my-zsh ] && source ~/.zsh/.oh-my-zsh.zsh
[ -d ~/.zplug ] && source ~/.zsh/.zplug.zsh
# alias/function を読み込む
# compdef は zplug の後に読み込まないとうまく動かない
source ~/.zsh/.aliases.zsh
# 環境依存の追加設定はここに定義(上書きできるよう最後に読み込む)
[ -f ~/.env.zsh ] && source ~/.env.zsh
# Profiling
#------------------
# NOTE: zprof を以下のコマンドで有効化すると表示される
# echo "zmodload zsh/zprof && zprof" > ~/.zshenv
if (which zprof >/dev/null 2>&1); then
zprof
fi
# Auto added...
#------------------
# The next line updates PATH for the Google Cloud SDK.
if [ -f '/Users/upinetree/google-cloud-sdk/path.zsh.inc' ]; then source '/Users/upinetree/google-cloud-sdk/path.zsh.inc'; fi
# The next line enables shell command completion for gcloud.
if [ -f '/Users/upinetree/google-cloud-sdk/completion.zsh.inc' ]; then source '/Users/upinetree/google-cloud-sdk/completion.zsh.inc'; fi