-
Notifications
You must be signed in to change notification settings - Fork 0
/
.zshrc
110 lines (92 loc) · 3.14 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
# ------------------------------
# Aliases
# ------------------------------
alias ..='cd ..'
alias ~='cd ~'
alias la='ls -la'
alias ll='ls -l'
alias mv='mv -i'
alias cp='cp -i'
alias c='clear'
alias gpl='git pull'
alias gps='git push'
alias gs='git status'
alias gc='git checkout'
alias gb='git branch'
alias gl='git log'
alias g-empty-commit='(){git commit --allow-empty -m $1}'
alias vim='nvim'
alias cat='bat'
alias tree='(){tree -I $1 -L $2}'
alias dc="docker compose"
alias workside='cd /Users/yuto/Workspace/workside'
alias first-automation='cd /Users/yuto/Workspace/first-automation'
alias tachibanayu24='cd /Users/yuto/Workspace/tachibanayu24'
alias reload='exec $SHELL -l'
# ------------------------------
# PATHs
# ------------------------------
export PATH="$PATH:/opt/homebrew/bin"
export PATH="$HOME/.rbenv/bin:$PATH"
export PATH=$PATH:./node_modules/.bin
export PATH="$HOME/bin:$PATH"
export PATH="$HOME/.pyenv/bin:$PATH"
# export CLOUDSDK_PYTHON="/usr/local/opt/[email protected]/bin/python3"
export CLOUDSDK_PYTHON=/usr/bin/python3
export PATH="$PATH:/Users/yuto/flutter-sdk/flutter/bin"
# ------------------------------
# Initialize Enviroments
# ------------------------------
eval "$(rbenv init -)"
eval "$(pyenv init -)"
# ------------------------------
# Load Themes
# ------------------------------
if [[ -s "${ZDOTDIR:-$HOME}/.zprezto/init.zsh" ]]; then
source "${ZDOTDIR:-$HOME}/.zprezto/init.zsh"
fi
# ------------------------------
# Prompt
# @see https://spaceship-prompt.sh/options
# ------------------------------
# NOTE: Warpとの相性が悪いようなので一旦コメントアウトしておく
# source /opt/homebrew/opt/spaceship/spaceship.zsh
# SPACESHIP_PROMPT_ORDER=(dir git node gcloud exec_time line_sep jobs exit_code char)
# SPACESHIP_PACKAGE_SHOW=false
# SPACESHIP_CHAR_SYMBOL="> "
# SPACESHIP_GIT_PREFIX=""
# SPACESHIP_AWS_PREFIX=""
# SPACESHIP_GCLOUD_PREFIX=""
# ------------------------------
# Avoiding commands
# ------------------------------
WARNING_MESSAGE="\e[33m[Warn] If you want to run this command, escape it with a '\'."
function check_dangerous_git_commands() {
if [[ $2 = "git push origin master" ]]; then
echo ${WARNING_MESSAGE}
kill -INT 0
elif [[ $2 = "git push origin develop" ]]; then
echo ${WARNING_MESSAGE}
kill -INT 0
elif [[ $2 = "git push origin HEAD" ]]; then
echo ${WARNING_MESSAGE}
kill -INT 0
fi
}
function check_opening_vscode() {
if [ $2 = "code /" ] || [ $2 = "code ," ] || [ "$2" = "code ,." ] || [ "$2" = "code .," ]; then
echo ${WARNING_MESSAGE}
kill -INT 0
fi
}
# ------------------------------
# Defining prompts, loading functions, etc.
# ------------------------------
setopt prompt_subst
autoload -Uz add-zsh-hook
add-zsh-hook preexec check_dangerous_git_commands
add-zsh-hook preexec check_opening_vscode
# The next line updates PATH for the Google Cloud SDK.
if [ -f '/Users/yuto/google-cloud-sdk/path.zsh.inc' ]; then . '/Users/yuto/google-cloud-sdk/path.zsh.inc'; fi
# The next line enables shell command completion for gcloud.
if [ -f '/Users/yuto/google-cloud-sdk/completion.zsh.inc' ]; then . '/Users/yuto/google-cloud-sdk/completion.zsh.inc'; fi