-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.zshrc
140 lines (114 loc) · 4.1 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
# tkinter
export PATH="/opt/homebrew/opt/tcl-tk/bin:$PATH"
export LDFLAGS="-L/opt/homebrew/opt/tcl-tk/lib"
export CPPFLAGS="-I/opt/homebrew/opt/tcl-tk/include"
export PKG_CONFIG_PATH="/opt/homebrew/opt/tcl-tk/lib/pkgconfig"
# pyenv
export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init --path)"
# git
git config --global user.name "sinohiro"
git config --global user.email [email protected]
# git-completion, git-prompt
fpath=(~/.zsh/completion $fpath)
autoload -Uz compinit
compinit -u
# prompt_custmise
fpath=(~/.zsh/completion $fpath)
autoload -Uz compinit
compinit -u
export CLICOLOR=1
function left-prompt {
name_t='179m%}' # user name text clolr
name_b='000m%}' # user name background color
path_t='255m%}' # path text clolr
path_b='031m%}' # path background color
arrow='087m%}' # arrow color
text_color='%{\e[38;5;' # set text color
back_color='%{\e[30;48;5;' # set background color
reset='%{\e[0m%}' # reset
sharp="\uE0B0" # triangle
user="${back_color}${name_b}${text_color}${name_t}"
dir="${back_color}${path_b}${text_color}${path_t}"
echo "${user}%n%#@%m${back_color}${path_b}${text_color}${name_b}${sharp} ${dir}%~${reset}${text_color}${path_b}${sharp}${reset}\n${text_color}${arrow}> ${reset}"
}
PROMPT=`left-prompt`
# コマンドの実行ごとに改行
function precmd() {
# Print a newline before the prompt, unless it's the
# first prompt in the process.
if [ -z "$NEW_LINE_BEFORE_PROMPT" ]; then
NEW_LINE_BEFORE_PROMPT=1
elif [ "$NEW_LINE_BEFORE_PROMPT" -eq 1 ]; then
echo ""
fi
}
# git ブランチ名を色付きで表示させるメソッド
function rprompt-git-current-branch {
local branch_name st branch_status
branch='\ue0a0'
color='%{\e[38;5;' # 文字色を設定
green='114m%}'
red='001m%}'
yellow='227m%}'
blue='033m%}'
reset='%{\e[0m%}' # reset
color='%{\e[38;5;' # 文字色を設定
green='114m%}'
# ブランチマーク
if [ ! -e ".git" ]; then
# git 管理されていないディレクトリは何も返さない
return
fi
branch_name=`git rev-parse --abbrev-ref HEAD 2> /dev/null`
st=`git status 2> /dev/null`
if [[ -n `echo "$st" | grep "^nothing to"` ]]; then
# 全て commit されてクリーンな状態
branch_status="${color}${green}${branch}"
elif [[ -n `echo "$st" | grep "^Untracked files"` ]]; then
# git 管理されていないファイルがある状態
branch_status="${color}${red}${branch}?"
elif [[ -n `echo "$st" | grep "^Changes not staged for commit"` ]]; then
# git add されていないファイルがある状態
branch_status="${color}${red}${branch}+"
elif [[ -n `echo "$st" | grep "^Changes to be committed"` ]]; then
# git commit されていないファイルがある状態
branch_status="${color}${yellow}${branch}!"
elif [[ -n `echo "$st" | grep "^rebase in progress"` ]]; then
# コンフリクトが起こった状態
echo "${color}${red}${branch}!(no branch)${reset}"
return
else
# 上記以外の状態の場合
branch_status="${color}${blue}${branch}"
fi
# ブランチ名を色付きで表示する
echo "${branch_status}$branch_name${reset}"
}
# プロンプトが表示されるたびにプロンプト文字列を評価、置換する
setopt prompt_subst
# プロンプトの右側にメソッドの結果を表示させる
RPROMPT='`rprompt-git-current-branch`'
export PATH="/opt/homebrew/opt/ncurses/bin:$PATH"
# docker補完
if [ -e ~/.zsh/completions ]; then
fpath=(~/.zsh/completions $fpath)
fi
autoload -U compinit
compinit
export LSCOLORS=cxfxcxdxbxegedabagacad
# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/Users/sinohiro/miniconda3/bin/conda' 'shell.zsh' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
eval "$__conda_setup"
else
if [ -f "/Users/sinohiro/miniconda3/etc/profile.d/conda.sh" ]; then
. "/Users/sinohiro/miniconda3/etc/profile.d/conda.sh"
else
export PATH="/Users/sinohiro/miniconda3/bin:$PATH"
fi
fi
unset __conda_setup
# <<< conda initialize <<<