-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdot_zshrc.tmpl
More file actions
209 lines (171 loc) · 5.02 KB
/
dot_zshrc.tmpl
File metadata and controls
209 lines (171 loc) · 5.02 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
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
# <<< Pre Block
# Kiro CLI pre block. Keep at the top of this file.
{{- if eq .chezmoi.os "darwin" }}
if [[ -f "${HOME}/Library/Application Support/kiro-cli/shell/zshrc.pre.zsh" ]]; then
builtin source "${HOME}/Library/Application Support/kiro-cli/shell/zshrc.pre.zsh"
fi
{{- else if eq .chezmoi.os "linux" }}
if [[ -f "${HOME}/.local/share/kiro-cli/shell/zshrc.pre.zsh" ]]; then
builtin source "${HOME}/.local/share/kiro-cli/shell/zshrc.pre.zsh"
fi
{{- end }}
# >>>
# <<< History Configuration
HISTSIZE=10000
SAVEHIST=10000
setopt HIST_IGNORE_DUPS
setopt HIST_IGNORE_SPACE
# >>>
# <<< Shell Options
setopt AUTO_CD # Change directory by typing directory name
setopt AUTO_PUSHD # Push directory to stack on cd
setopt PUSHD_IGNORE_DUPS # Ignore duplicate directories in stack
setopt CORRECT # Correct command spelling
# >>>
# <<< Prompt Configuration
PS1='%n@%m:%1~%# '
# >>>
# <<< Plugins
{{ if eq .chezmoi.os "darwin" }}
# Add Homebrew's site-functions to fpath
if [[ -d "/opt/homebrew/share/zsh/site-functions" ]]; then
fpath=(/opt/homebrew/share/zsh/site-functions $fpath)
fi
{{- end }}
# Initialize completion system
autoload -Uz compinit
compinit
{{ if eq .chezmoi.hostname "7cf34ded5d65" }}
# Brazil Completion
if [[ -f "${HOME}/.brazil_completion/zsh_completion" ]]; then
builtin source "${HOME}/.brazil_completion/zsh_completion"
fi
{{- end }}
# 1Password CLI Completion
if [ -x "$(command -v op)" ]; then
eval "$(op completion zsh)"; compdef _op op
fi
# direnv
if [ -x "$(command -v direnv)" ]; then
eval "$(direnv hook zsh)"
fi
# Zsh Vi Mode
{{- if eq .chezmoi.os "darwin" }}
if [[ -f "$(brew --prefix)/opt/zsh-vi-mode/share/zsh-vi-mode/zsh-vi-mode.plugin.zsh" ]]; then
builtin source "$(brew --prefix)/opt/zsh-vi-mode/share/zsh-vi-mode/zsh-vi-mode.plugin.zsh"
fi
{{- else if eq .chezmoi.os "linux" }}
# zinit
if [[ -f "/usr/local/share/zinit/zinit.git/zinit.zsh" ]]; then
source "/usr/local/share/zinit/zinit.git/zinit.zsh"
autoload -Uz _zinit
(( ${+_comps} )) && _comps[zinit]=_zinit
# zsh-vi-mode
zinit ice depth=1
zinit light jeffreytse/zsh-vi-mode
fi
{{- end }}
# >>>
# <<< Key Bindings
bindkey -M vicmd "H" beginning-of-line
bindkey -M vicmd "L" end-of-line
# >>>
# <<< Aliases
# bat aliases
{{- if eq .chezmoi.os "darwin" }}
if command -v bat &> /dev/null; then
alias less="bat"
fi
{{- else if eq .chezmoi.os "linux" }}
if command -v batcat &> /dev/null; then
alias bat="batcat"
alias less="batcat"
elif command -v bat &> /dev/null; then
alias less="bat"
fi
{{- end }}
# ls aliases
{{- if eq .chezmoi.os "darwin" }}
alias ls="gls -F --color=auto"
alias ll="gls -lF --color=auto"
alias la="gls -aF --color=auto"
alias lal="gls -alF --color=auto"
{{- else if eq .chezmoi.os "linux" }}
alias ls="ls -F --color=auto"
alias ll="ls -lF --color=auto"
alias la="ls -aF --color=auto"
alias lal="ls -alF --color=auto"
{{- end }}
# Safe operations
alias cp="cp -i"
alias ln="ln -i"
alias mv="mv -i"
alias rm="rm -i"
# Navigation
alias ..="cd .."
alias ...="cd ../.."
alias d="dirs -v"
# Disk usage
alias df="df -h"
alias du="du -h"
# Grep with color
alias grep="grep --color=auto"
# History
alias h="history"
alias hg="history | grep"
# Editor
alias vi="vim"
alias view="vim -R"
alias zprofile="${EDITOR} ~/.zprofile"
alias zshrc="${EDITOR} ~/.zshrc"
{{ if eq .chezmoi.os "darwin" }}
# GNU Coreutils
alias date="gdate"
alias readlink="greadlink"
alias realpath="grealpath"
alias sed="gsed"
alias timeout="gtimeout"
{{- end }}
{{ if eq .chezmoi.os "linux" }}
# 1Password CLI
alias opsignin='eval $(op signin)'
{{- end }}
{{ if eq .chezmoi.hostname "7cf34ded5d65" }}
# chezmoi
alias chezmoiaddinternal="chezmoi add --source=$HOME/Documents/git/dotfiles-internal"
alias chezmoiapplyinternal="chezmoi apply --source=$HOME/Documents/git/dotfiles-internal"
{{- end }}
{{ if eq .chezmoi.os "darwin" }}
# Google Chrome
alias chrome-agent="/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --remote-debugging-port=9222 --remote-allow-origins=http://localhost:9222 --user-data-dir=~/Library/Application\ Support/Google/Chrome\ Agent --no-first-run"
{{- end }}
# Kiro CLI
alias k="kiro-cli chat"
alias ka="kiro-cli chat --agent"
alias kr="kiro-cli chat --resume"
# >>>
# <<< Safe-chain Initialization
# Safe-chain Zsh initialization script
if [[ -f "${HOME}/.safe-chain/scripts/init-posix.sh" ]]; then
builtin source "${HOME}/.safe-chain/scripts/init-posix.sh"
fi
# >>>
{{- if eq .chezmoi.hostname "7cf34ded5d65" }}
# <<< Midway Key Check
if [[ -x "${HOME}/.local/bin/check-midway-key" ]]; then
check-midway-key
fi
# >>>
{{- end }}
# <<< Post Block
# Kiro CLI post block. Keep at the bottom of this file.
{{- if eq .chezmoi.os "darwin" }}
if [[ -f "${HOME}/Library/Application Support/kiro-cli/shell/zshrc.post.zsh" ]]; then
builtin source "${HOME}/Library/Application Support/kiro-cli/shell/zshrc.post.zsh"
fi
{{- else if eq .chezmoi.os "linux" }}
if [[ -f "${HOME}/.local/share/kiro-cli/shell/zshrc.post.zsh" ]]; then
builtin source "${HOME}/.local/share/kiro-cli/shell/zshrc.post.zsh"
fi
{{- end }}
# >>>