質問編集履歴
1
追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -30,5 +30,217 @@
|
|
30
30
|
brew postinstall python@3.9
|
31
31
|
```
|
32
32
|
|
33
|
+
# zshのなか
|
34
|
+
|
35
|
+
```
|
36
|
+
### プラグイン管理
|
37
|
+
autoload -Uz _zinit
|
38
|
+
### Added by Zinit's installer
|
39
|
+
if [[ ! -f $HOME/.local/share/zinit/zinit.git/zinit.zsh ]]; then
|
40
|
+
print -P "%F{33} %F{220}Installing %F{33}ZDHARMA-CONTINUUM%F{220} Initiative Plugin Manager (%F{33}zdharma-continuum/zinit%F{220})…%f"
|
41
|
+
command mkdir -p "$HOME/.local/share/zinit" && command chmod g-rwX "$HOME/.local/share/zinit"
|
42
|
+
command git clone https://github.com/zdharma-continuum/zinit "$HOME/.local/share/zinit/zinit.git" && \
|
43
|
+
print -P "%F{33} %F{34}Installation successful.%f%b" || \
|
44
|
+
print -P "%F{160} The clone has failed.%f%b"
|
45
|
+
fi
|
46
|
+
|
47
|
+
source "$HOME/.local/share/zinit/zinit.git/zinit.zsh"
|
48
|
+
autoload -Uz _zinit
|
49
|
+
(( ${+_comps} )) && _comps[zinit]=_zinit
|
50
|
+
|
51
|
+
## 便利プラグや設定
|
52
|
+
## コマンドシンタックスハイライト
|
53
|
+
zinit load zsh-users/zsh-syntax-highlighting
|
54
|
+
## 入力補完(コマンド履歴に基づいてコマンド候補を表示:単体)
|
55
|
+
zinit load zsh-users/zsh-autosuggestions
|
56
|
+
## 入力補完(コマンドやファイル名の入力中にTabキーを推すことで入力候補を表示:複数)
|
57
|
+
zinit ice wait'0'; zinit load zsh-users/zsh-completions
|
58
|
+
autoload -Uz compinit && compinit
|
59
|
+
## 補完で小文字でも大文字にマッチさせる
|
60
|
+
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}'
|
61
|
+
## 補完候補を一覧表示したとき、Tabや矢印で選択できるようにする
|
62
|
+
zstyle ':completion:*:default' menu select=1
|
63
|
+
## コマンド履歴を検索(Ctrl+R)
|
64
|
+
function peco-history-selection() {
|
65
|
+
BUFFER=`history -n 1 | tac | awk '!a[$0]++' | peco`
|
66
|
+
CURSOR=$#BUFFER
|
67
|
+
zle reset-prompt
|
68
|
+
}
|
69
|
+
zle -N peso-history-selection
|
70
|
+
bindkey '^R' peco-history-selection
|
71
|
+
## コマンド履歴からディレクトリ検索・移動
|
72
|
+
if [[ -n $(echo ${^fpath}/chpwd_recent_dirs(N)) && -n $(echo ${^fpath}/cdr(N)) ]]; then
|
73
|
+
autoload -Uz chpwd_recent_dirs cdr add-zsh-hook
|
74
|
+
add-zsh-hook chpwd chpwd_recent_dirs
|
75
|
+
zstyle ':completion:*' recent-dirs-insert both
|
76
|
+
zstyle ':chpwd:*' recent-dirs-default true
|
77
|
+
zstyle ':chpwd:*' recent-dirs-max 1000
|
78
|
+
zstyle ':chpwd:*' recent-dirs-file "$HOME/.cache/chpwd-recent-dirs"
|
79
|
+
fi
|
80
|
+
function peco-cdr () {
|
81
|
+
local selected_dir="$(cdr -l | sed 's/^[0-9]* *//' | peco)"
|
82
|
+
if [ -n "$selected_dir" ]; then
|
83
|
+
BUFFER="cd ${selected_dir}"
|
84
|
+
zle accept-line
|
85
|
+
fi
|
86
|
+
}
|
87
|
+
zle -N peco-cdr
|
88
|
+
bindkey '^E' peco-cdr
|
89
|
+
## カレントディレクトリ以下のディレクトリ検索・移動
|
90
|
+
function find_cd() {
|
91
|
+
local selected_dir=$(find . -type d | peco)
|
92
|
+
if [ -n "$selected_dir" ]; then
|
93
|
+
BUFFER="cd ${selected_dir}"
|
94
|
+
zle accept-line
|
95
|
+
fi
|
96
|
+
}
|
97
|
+
zle -N find_cd
|
98
|
+
bindkey '^X' find_cd
|
99
|
+
|
100
|
+
|
101
|
+
|
102
|
+
### Zsh(Iterm2)の設定
|
103
|
+
## ターミナルの上(タブ)にカレントディレクトリを表示
|
104
|
+
precmd() { eval 'echo -ne "\033]0;$PWD\007"' }
|
105
|
+
|
106
|
+
## zsh-completions(補完機能)の設定
|
107
|
+
if [ -e /usr/local/share/zsh-completions ]; then
|
108
|
+
fpath=(/usr/local/share/zsh-completions $fpath)
|
109
|
+
fi
|
110
|
+
autoload -U compinit
|
111
|
+
compinit -u
|
112
|
+
|
113
|
+
|
114
|
+
|
115
|
+
### PATHを通す
|
116
|
+
export LANG=ja_JP.UTF-8
|
117
|
+
export PS1="%~ %# "
|
118
|
+
export PATH="/usr/local/bin:$PATH"
|
119
|
+
export PATH="/usr/local/sbin:$PATH"
|
120
|
+
export PATH=/bin:/usr/bin:/usr/local/bin:${PATH}
|
121
|
+
export PATH=$HOME/.nodebrew/current/bin:$PATH
|
122
|
+
export NODE_PATH="/Users/matsuochinyu/.nodebrew/node/v18.0.0/bin"
|
123
|
+
export PATH="/usr/local/opt/mysql/bin:$PATH"
|
124
|
+
export PATH="/usr/local/opt/mysql-client/bin:$PATH"
|
125
|
+
export PATH="$PATH:/opt/homebrew/bin/"
|
126
|
+
export PATH=$H2_HOME/bin:$PATH
|
127
|
+
|
128
|
+
|
129
|
+
|
130
|
+
### anyenv(ほぼ全てのプログラミング言語のenv)
|
131
|
+
eval "$(anyenv init -)"
|
132
|
+
|
133
|
+
|
134
|
+
|
135
|
+
### mysqlの設定
|
136
|
+
export LDFLAGS="-L/usr/local/opt/mysql-client/lib"
|
137
|
+
export CPPFLAGS="-I/usr/local/opt/mysql-client/include"
|
138
|
+
export PKG_CONFIG_PATH="/usr/local/opt/mysql-client/lib/pkgconfig"
|
139
|
+
|
140
|
+
|
141
|
+
|
142
|
+
### Pythonの設定
|
143
|
+
## Python3
|
144
|
+
## python3.10
|
145
|
+
#export PATH="/usr/local/opt/python@3.10/bin:$PATH"
|
146
|
+
#export LDFLAGS="-L/usr/local/opt/python@3.10/lib"
|
147
|
+
#export PKG_CONFIG_PATH="/usr/local/opt/python@3.10/lib/pkgconfig"
|
148
|
+
## python3.9
|
149
|
+
#export PATH="/usr/local/opt/python@3.9/libexec/bin:$PATH"
|
150
|
+
|
151
|
+
alias python='python3'
|
152
|
+
alias pip='python -m pip'
|
153
|
+
alias pipf='pip freeze'
|
154
|
+
|
155
|
+
## Python2
|
156
|
+
export PATH="$HOME/Library/Python/2.7/bin:$PATH"
|
157
|
+
alias python2='python2'
|
158
|
+
alias pip2='pip2'
|
159
|
+
|
160
|
+
|
161
|
+
|
162
|
+
### Goの設定
|
163
|
+
export GO111MODULE=auto
|
164
|
+
export GOROOT="/usr/local/Cellar/go/1.18.4/libexec"
|
165
|
+
export GOPATH="$(go env GOPATH)"
|
166
|
+
export PATH=$PATH:$(go env GOPATH)/bin
|
167
|
+
|
168
|
+
|
169
|
+
|
170
|
+
### cの設定
|
171
|
+
## 〇〇.outだけでできるようになる
|
172
|
+
export PATH=.:$PATH
|
173
|
+
|
174
|
+
|
175
|
+
|
176
|
+
### Rubyの設定
|
177
|
+
export PATH="$HOME/.rbenv/bin:$PATH"
|
178
|
+
eval "$(rbenv init - zsh)"
|
179
|
+
|
180
|
+
|
181
|
+
|
182
|
+
### Javaの設定
|
183
|
+
export CPPFLAGS="-I/usr/local/opt/openjdk/include"
|
184
|
+
export M2_HOME=/usr/local/Cellar/maven/3.8.1/libexec/
|
185
|
+
export JAVA_HOME='/usr/libexec/java_home -v 18'
|
186
|
+
export PATH=${JAVA_HOME}/bin:${PATH}
|
187
|
+
|
188
|
+
|
189
|
+
|
190
|
+
### PHPの設定
|
191
|
+
export PATH="/usr/local/opt/php/bin:$PATH"
|
192
|
+
|
193
|
+
|
194
|
+
|
195
|
+
### Aliasの設定
|
196
|
+
## プログラミング
|
197
|
+
alias ts='tsc'
|
198
|
+
## その他
|
199
|
+
alias c='clear'
|
200
|
+
alias h='history'
|
201
|
+
alias ls='ls -a'
|
202
|
+
alias tree='tree -a'
|
203
|
+
alias rm='rm -r'
|
204
|
+
alias cp='cp -r'
|
205
|
+
alias vzsh='vim ~/.zshrc'
|
206
|
+
alias ozsh='open ~/.zshrc'
|
207
|
+
alias szsh='source ~/.zshrc'
|
208
|
+
alias maven='mvn'
|
209
|
+
|
210
|
+
|
211
|
+
|
212
|
+
### setupの設定
|
213
|
+
## 日本語のファイル名も表示可能にする
|
214
|
+
setopt print_eight_bit
|
215
|
+
|
216
|
+
## cdなしでもディレクトリを入力するだけで移動可能
|
217
|
+
setopt auto_cd
|
218
|
+
|
219
|
+
## 同時に起動しているzshの間でhistoryを共有する
|
220
|
+
setopt share_history
|
221
|
+
|
222
|
+
## 同じコマンドをhistoryに残さない
|
223
|
+
setopt hist_ignore_all_dups
|
224
|
+
## 環境変数を保管
|
225
|
+
setopt AUTO_PARAM_KEYS
|
226
|
+
|
227
|
+
|
228
|
+
|
229
|
+
### その他
|
230
|
+
#ssh-add -K ~/.ssh/id_rsa
|
231
|
+
|
232
|
+
## コマンドプロンプト(Powerlevel10k)の設定
|
233
|
+
# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc.
|
234
|
+
# Initialization code that may require console input (password prompts, [y/n]
|
235
|
+
# confirmations, etc.) must go above this block; everything else may go below.
|
236
|
+
if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
|
237
|
+
source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
|
238
|
+
fi
|
239
|
+
source ~/powerlevel10k/powerlevel10k.zsh-theme
|
240
|
+
|
241
|
+
# To customize prompt, run p10k configure or edit ~/.p10k.zsh.
|
242
|
+
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zshexport
|
243
|
+
```
|
244
|
+
|
33
245
|
### 補足情報(FW/ツールのバージョンなど)
|
34
246
|
MacOS:catalina 10.15.7
|