-
Notifications
You must be signed in to change notification settings - Fork 0
/
.zshrc
99 lines (88 loc) · 2.92 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
######## default PATH #######
export PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
######## for brew ##########
eval "$(/opt/homebrew/bin/brew shellenv)"
export HOMEBREW_NO_AUTO_UPDATE=1 # 自動的に brew update しない
####### vim #######
# <C-s>が効くようにする
stty start undef
stty stop undef
setopt noflowcontrol
####### packages #######
# https://github.com/zsh-users/zsh-autosuggestions
source /opt/homebrew/share/zsh-autosuggestions/zsh-autosuggestions.zsh
# https://github.com/zsh-users/zsh-syntax-highlighting
source /opt/homebrew/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
# https://github.com/rupa/z
source ~/.zsh.d/z.sh
eval "$(rbenv init - zsh)"
eval "$(nodenv init -)"
####### prompt #######
PROMPT='%F{magenta}%~ $ %f'
autoload -Uz vcs_info
setopt prompt_subst
zstyle ':vcs_info:git:*' check-for-changes true
zstyle ':vcs_info:git:*' stagedstr "%F{yellow}!"
zstyle ':vcs_info:git:*' unstagedstr "%F{red}+"
zstyle ':vcs_info:*' formats "%F{green}%c%u[%b]%f"
zstyle ':vcs_info:*' actionformats '[%b|%a]'
precmd() { vcs_info }
RPROMPT='${vcs_info_msg_0_}'
###### colors ######
# lsで表示されるファイル・フォルダの色を見やすくする http://d.hatena.ne.jp/edvakf/20080413/1208042916
export CLICOLOR=1
export LSCOLORS=gxfxcxdxbxegedabagacad
if [ -n "$LS_COLORS" ]; then
zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS}
fi
####### history #######
SAVEHIST=100000
# 同一ホストで自分が動かしているすべてのzshのプロセスで履歴を共有
setopt share_history
####### completion #######
zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}'
####### alias #######
alias ghl='cd $(ghq root)/$(ghq list | peco)'
alias v='vim .'
alias vz='vim ~/.zshrc'
alias vv='vim ~/.vimrc'
alias sz='source ~/.zshrc'
alias va='vim ~/.aws/credentials'
alias gl='git log'
alias gpl='git pull'
alias gs='git status'
alias ga='git add'
alias gb='git branch'
alias gc='git commit -m'
alias gd='git diff'
alias gdc='git diff --cached'
alias go='git checkout'
alias gsl='git stash list'
alias grh='git reset --hard head'
alias ghb='gh browse'
alias dc='docker-compose'
alias da='docker attach'
alias ssm='aws ssm start-session --profile gadev --target $(grep -w Host ~/.ssh/config | awk '\''{print $2}'\'' | peco | head -n1 | awk -F "-" '\''{print $(NF-1) "-" $NF}'\'')'
########## function ############
gsa () {
git stash apply stash@{$1}
}
gsp () {
git stash pop stash@{$1}
}
grep_rails () {
grep -rlI --exclude-dir={vendor,log,coverage,node_modules,tmp,public} "$1" "$2"/*
}
grep_rails_regex () {
grep -rlIE --exclude-dir={vendor,log,coverage,node_modules,tmp} "$1" "$2"/*
}
grep_rails_more () {
grep -rI --exclude-dir={vendor,log,coverage,node_modules,tmp,public} "$1" "$2"/*
}
replace_rails () {
grep -rlI --exclude-dir={vendor,log,coverage,node_modules,tmp} "$1" "$3"/* | xargs sed -i '' -e "s/$1/$2/g"
}
aws_ssm () {
aws ssm start-session --target $1
}
echo '******* .zshrc loaded *******'