-
Notifications
You must be signed in to change notification settings - Fork 0
/
zshrc
151 lines (125 loc) · 4.79 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
# 設定読み込み
source ~/dotfiles/zshrc.basic_config
source ~/dotfiles/zshrc.alias
source ~/dotfiles/zshrc.completion
source ~/dotfiles/zshrc.extra.commands
source <(kubectl completion zsh)
source ~/dotfiles/zshrc.kubebuilder
source ~/dotfiles-extra/zshrc.cycloud
source ~/dotfiles-extra/zshrc.extra.commands
source ~/dotfiles-extra/zshrc.private.servers
# VCSのブランチ名をプロンプトに表示
autoload -Uz vcs_info
zstyle ':vcs_info:*' formats '(%s)-[%b]'
zstyle ':vcs_info:*' actionformats '(%s)-[%b|%a]'
precmd () {
psvar=()
LANG=en_US.UTF-8 vcs_info
[[ -n "$vcs_info_msg_0_" ]] && psvar[1]="$vcs_info_msg_0_"
}
# プロンプト
PROMPT="%{${fg[cyan]}%}%/%{${reset_color}%} "
PROMPT2="%{${fg[cyan]}%}%_%{${reset_color}%} "
SPROMPT="%{${fg[red]}%}%r is correct? [n,y,a,e]:%{${reset_color}%} "
RPROMPT="%1(v|%F{green}%1v%f|)"
[ -n "${REMOTEHOST}${SSH_CONNECTION}" ] && PROMPT="%{${fg[green]}%}%n@${HOST%%.*} ${PROMPT}"
# 履歴
HISTFILE=~/.zsh_history
HISTSIZE=100000
SAVEHIST=1000000
setopt hist_ignore_dups # 連続して重複したコマンドラインはヒストリに追加しない
setopt share_history # 履歴の共有
setopt hist_no_store # historyコマンドをhistoryに保存しない
setopt hist_reduce_blanks # 余分なスペースを削除してヒストリに記録する
setopt extended_history # 履歴ファイルに時刻を記録
setopt inc_append_history # 履歴をインクリメンタルに追加
setopt hist_ignore_space # スペースで始まるコマンド行はヒストリリストから削除
setopt hist_verify # ヒストリを呼び出してから実行する間に一旦編集可能
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
# manコマンドに色をつける
export MANPAGER='less -R'
man() {
env \
LESS_TERMCAP_mb=$(printf "\e[1;31m") \
LESS_TERMCAP_md=$(printf "\e[1;31m") \
LESS_TERMCAP_me=$(printf "\e[0m") \
LESS_TERMCAP_se=$(printf "\e[0m") \
LESS_TERMCAP_so=$(printf "\e[1;44;33m") \
LESS_TERMCAP_ue=$(printf "\e[0m") \
LESS_TERMCAP_us=$(printf "\e[1;32m") \
man "$@"
}
# phpenv
export PATH="$HOME/.phpenv/bin:$PATH"
eval "$(phpenv init -)"
export PATH="$HOME/.rbenv/bin:$PATH"
export PATH="$HOME/local/bin:$PATH"
if [ -d "$HOME/.rbenv" ]; then
eval "$(rbenv init -)"
fi
export PATH="$HOME/.pyenv/bin:$PATH"
eval "$(pyenv init --path)"
if [ -e "~/perl5/perlbrew/etc/bashrc" ]; then
source ~/perl5/perlbrew/etc/bashrc
fi
PS1="$PS1"'$([ -n "$TMUX" ] && tmux setenv TMUXPWD_$(tmux display -p "#D" | tr -d %) "$PWD")'
if [ -e /usr/local/share/zsh-completions ]; then
fpath=(/usr/local/share/zsh-completions $fpath)
fi
export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"
test -e "${HOME}/.iterm2_shell_integration.zsh" && source "${HOME}/.iterm2_shell_integration.zsh"
# GOPATH, GOROOT(Mac)
export GOPATH="$HOME/go"
export PATH="$GOPATH/bin:$PATH"
export GOENV_ROOT="$HOME/.goenv"
export PATH="$GOENV_ROOT/bin:$PATH"
export GOENV_DISABLE_GOPATH=1
eval "$(goenv init -)"
# Rust
#source $HOME/.cargo/env
export PATH="$HOME/.cargo/bin:$PATH"
case ${OSTYPE} in
darwin*)
export PATH="/usr/local/opt/opencv3/bin:$PATH"
#export LDFLAGS="-L/usr/local/opt/readline/lib";
export CPPFLAGS="-I/usr/local/opt/readline/include";
export PATH=/usr/local/opt/qt5/bin:$PATH
export PKG_CONFIG_PATH="/usr/local/opt/readline/lib/pkgconfig";
;;
linux*)
# そのうちOSごとに読み込むの切り替えたい
;;
esac
## asdf
#. $HOME/.asdf/asdf.sh
# つーかzshrcきったね
case ${OSTYPE} in
darwin*)
export PATH="/opt/homebrew/opt/[email protected]/bin:$PATH"
#export LDFLAGS="-L/usr/local/opt/mysql-client/lib";
export CPPFLAGS="-I/usr/local/opt/mysql-client/include";
export PKG_CONFIG_PATH="/usr/local/opt/mysql-client/lib/pkgconfig";
export PATH="/opt/homebrew/opt/libpq/bin:$PATH";
export PATH="/usr/local/opt/mysql-client/bin:$PATH";
;;
linux*)
;;
esac
export LDFLAGS="-s -w";
source "$HOME/kube-ps1/kube-ps1.sh"
PS1='$(kube_ps1)'$PS1
# krew
export PATH="${KREW_ROOT:-$HOME/.krew}/bin:$PATH"
# Generated for envman. Do not edit.
[ -s "$HOME/.config/envman/load.sh" ] && source "$HOME/.config/envman/load.sh"
# The next line updates PATH for the Google Cloud SDK.
if [ -f "$HOME/google-cloud-sdk/path.zsh.inc" ]; then . "$HOME/google-cloud-sdk/path.zsh.inc"; fi
# The next line enables shell command completion for gcloud.
if [ -f "$HOME/google-cloud-sdk/completion.zsh.inc" ]; then . "$HOME/google-cloud-sdk/completion.zsh.inc"; fi
export PATH="$PATH:$HOME/flutter/bin"