-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdot_zshrc
More file actions
176 lines (152 loc) · 4.15 KB
/
dot_zshrc
File metadata and controls
176 lines (152 loc) · 4.15 KB
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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
#--------------------------------------
# Environment
#--------------------------------------
# LANG
export LANG=en_US.UTF-8
# Editor
export EDITOR=nvim
# less
export LESS='-R'
# GPG
export GPG_TTY=$(tty)
#--------------------------------------
# Alias
#--------------------------------------
# ls
case "${OSTYPE}" in
darwin*)
alias ls='ls -GF'
;;
linux*)
alias ls='ls --color -F'
;;
esac
alias ll='ls -lh'
alias la='ll -a'
alias p='popd'
# vim
alias vim='nvim'
alias tm='tmux a -t'
alias tml='tmux list-sessions'
# Ruby
alias be='bundle exec'
alias rr='be rubocop -A $(git status -s "*.rb" | cut -c4-)'
# Git
alias gg='git grep'
alias gfe='git fetch'
alias gco='git checkout'
alias gcob='git checkout -b'
alias gst='git status'
alias gci='git commit'
alias gcia='git commit --amend'
alias gcic='git-commit-with-claude'
alias gme='git merge'
alias gdi='git diff'
alias gdic='gdi --cached'
alias gbr='git branch'
alias gsh='git show'
alias gps='git push'
alias gpsu='gps upstream'
alias gpso='gps origin'
alias gpsoc='git push origin `git-current-branch`'
alias gpsocf='git push -f origin `git-current-branch`'
alias gpl='git pull'
alias gplu='gpl upstream'
alias gplo='gpl origin'
alias gad='git add'
alias gadp='git add -p'
alias glo='git log'
alias gcp='git cherry-pick'
alias gre='git rebase'
alias grei='git rebase -i'
alias gres='git reset'
alias gwc='git whatchanged'
alias glog='git-log-graph'
alias gcpo='git-co-pull-origin'
alias gcpu='git-co-pull-upstream'
# fzf
alias pgco='fzf_git_checkout_branch'
# Docker
alias dc='docker compose'
# Terraform
alias tf='terraform'
# ripgrep
alias rga='rg --hidden --no-ignore'
#--------------------------------------
# Prompt
#--------------------------------------
eval "$(starship init zsh)"
#--------------------------------------
# History
#--------------------------------------
HISTFILE=$HOME/.zsh/.zsh_history
HISTSIZE=10000
SAVEHIST=100000
# history に保存しないコマンド
HISTORY_IGNORE="(ls|ll|cd|pwd|gst|gdi|gdic|gpsoc|gfe|glo|grei|gci|gcia|gco|gsh)"
# 同じコマンドを重複して記録しない
setopt hist_ignore_dups
# 履歴ファイルに時刻を記録
setopt extended_history
# ヒストリファイルを共有する
setopt share_history
# 複数の zsh を同時に使う時など history ファイルに上書きせず追加
setopt append_history
# history コマンドを記録しない
setopt hist_no_store
# 余分な空白を詰めて記録
setopt hist_reduce_blanks
# 履歴検索中、重複を飛ばす
setopt hist_find_no_dups
# 行頭がスペースのコマンドは記録しない
setopt hist_ignore_space
# root のコマンドはヒストリに追加しない
if [ $UID = 0 ]; then
unset HISTFILE
SAVEHIST=0
fi
#--------------------------------------
# Completion
#--------------------------------------
autoload -Uz compinit
compinit
# ビープ音を鳴らさないようにする
setopt nolistbeep
# 補完候補を一覧表示
setopt auto_list
# 補完候補を詰めて表示
setopt list_packed
# 補完候補の色付け
export ZLS_COLORS=$LS_COLORS
zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS}
# 大文字・小文字を区別しない(大文字を入力した場合は区別する)
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}'
# 補完候補を矢印キーなどで選択できるようにする
zstyle ':completion:*:default' menu select
# --prefix=/usr などの = 以降でも補完
setopt magic_equal_subst
# カッコの対応などを自動的に補完する
setopt auto_param_keys
#--------------------------------------
# Keybind
#--------------------------------------
# Emacs 風のキーバインド
bindkey -e
# glob (*) でヒストリをインクリメンタル検索
bindkey '^R' history-incremental-pattern-search-backward
bindkey '^S' history-incremental-pattern-search-forward
#--------------------------------------
# Other
#--------------------------------------
# cd を押さずに cd
setopt auto_cd
# 移動したディレクトリを記録しておく
setopt auto_pushd
# 自動修正
setopt correct
# C-s でロックされるのを防ぐ
stty stop undef
# fzf
for f (~/.zsh/fzf-sources/*) source "${f}"
# git
for f (~/.zsh/git-scripts/*) source "${f}"