-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdot_profile.tmpl
More file actions
249 lines (195 loc) · 5.99 KB
/
dot_profile.tmpl
File metadata and controls
249 lines (195 loc) · 5.99 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
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
# shellcheck shell=sh
#==============================================================#
## ENVIRONMENT VARIABLES ##
#==============================================================#
export XDG_CONFIG_HOME="${HOME}/.config"
export XDG_DATA_HOME="${HOME}/.local/share"
export XDG_CACHE_HOME="${HOME}/.cache"
export XDG_STATE_HOME="${HOME}/.local/state"
export HOMEBREW_BUNDLE_FILE="${HOME}/.Brewfile"
export VISUAL="{{ .editor }}"
export EDITOR="{{ .editor }}"
export WORKSPACE_DIR="${HOME}/workspace"
export TLDR_AUTO_UPDATE_DISABLED="true"
export MANPAGER='nvim +Man!'
# {{- if eq .chezmoi.os "darwin" }}
if command -v xcrun >/dev/null 2>&1; then
SDKROOT="$(xcrun --sdk macosx --show-sdk-path)"
export SDKROOT
fi
# {{- end }}
if [ -x /home/linuxbrew/.linuxbrew/bin/brew ]; then
# shellcheck disable=SC2312
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
elif [ -x "${HOME}/.linuxbrew/bin/brew" ]; then
# shellcheck disable=SC2312
eval "$("${HOME}/.linuxbrew/bin/brew" shellenv)"
fi
#==============================================================#
## PATH ##
#==============================================================#
export PATH="${PATH}:/usr/sbin:/sbin"
# {{- if eq .chezmoi.os "darwin" }}
if [ -d "/opt/homebrew/opt/coreutils/libexec/gnubin" ]; then
export PATH="/opt/homebrew/opt/coreutils/libexec/gnubin:${PATH}"
fi
if [ -d "/usr/local/opt/coreutils/libexec/gnubin" ]; then
export PATH="/usr/local/opt/coreutils/libexec/gnubin:${PATH}"
fi
if [ -d "/opt/homebrew/bin" ]; then
export PATH="/opt/homebrew/bin:${PATH}"
fi
if [ -d "/opt/homebrew/sbin" ]; then
export PATH="/opt/homebrew/sbin:${PATH}"
fi
# {{- end }}
if [ -d "${HOME}/.deno/bin" ]; then
export DENO_INSTALL="${HOME}/.deno"
export PATH="${DENO_INSTALL}/bin:${PATH}"
fi
if [ -d "/opt/homebrew/opt/dotnet@8/libexec" ]; then
export DOTNET_ROOT="/opt/homebrew/opt/dotnet@8/libexec"
fi
if [ -d "/opt/homebrew/opt/dotnet@8/bin" ]; then
export PATH="/opt/homebrew/opt/dotnet@8/bin:${PATH}"
fi
if [ -d "${HOME}/.dotnet/tools" ]; then
export PATH="${HOME}/.dotnet/tools:${PATH}"
fi
if [ -d "${HOME}/.cargo/bin" ]; then
export PATH="${HOME}/.cargo/bin:${PATH}"
export CARGO_TARGET_DIR="${HOME}/.cargo/target"
fi
if [ -d "${HOME}/.nvm" ]; then
export NVM_DIR="${HOME}/.nvm"
# shellcheck disable=SC1091
. "${NVM_DIR}/nvm.sh"
if [ -d "${NVM_DIR}/bash_completion" ]; then
# shellcheck disable=SC1091
. "${NVM_DIR}/bash_completion"
fi
fi
if [ -d "${HOME}/Library/pnpm" ]; then
export PNPM_HOME="${HOME}/Library/pnpm"
export PATH="$PNPM_HOME:$PATH"
fi
if [ -d "${HOME}/.rbenv" ]; then
export PATH="${HOME}/.rbenv/bin:${PATH}"
export PATH="${HOME}/.rbenv/shims:${PATH}"
fi
if [ -d "/usr/local/go/bin" ]; then
export PATH="/usr/local/go/bin:${PATH}"
fi
if [ -d "${HOME}/go/bin" ]; then
export PATH="${HOME}/go/bin:${PATH}"
fi
if [ -d "${HOME}/.pyenv" ]; then
export PYENV_ROOT="${HOME}/.pyenv"
export PATH="${PYENV_ROOT}/bin:${PATH}"
eval "$(pyenv init --path)" || true
fi
if [ -d "${HOME}/.opencode/bin" ]; then
export PATH="${HOME}/.opencode/bin:${PATH}"
fi
if [ -d "${HOME}/bin" ]; then
export PATH="${HOME}/bin:${PATH}"
fi
if [ -d "${HOME}/.local/bin" ]; then
export PATH="${HOME}/.local/bin:${PATH}"
fi
if [ -d "${HOME}/.nix-profile/bin" ]; then
export PATH="${HOME}/.nix-profile/bin:${PATH}"
fi
if [ -d "${HOME}/.bun/bin" ]; then
export PATH="${HOME}/.bun/bin:${PATH}"
fi
if [ -d "${HOME}/Library/Application Support/Coursier/bin" ]; then
export PATH="${HOME}/Library/Application Support/Coursier/bin:${PATH}"
fi
#==============================================================#
## FUNCTIONS ##
#==============================================================#
ask() {
while true; do
printf '%s [y/n] ' "${1}"
read -r reply </dev/stdin
# Check if the reply is valid
case "${reply}" in
Y* | y*) return 0 ;;
N* | n*) return 1 ;;
*) echo 'Please answer yes or no.' ;;
esac
done
}
work() {
(cd "${WORKSPACE_DIR}"/"$1" && nvim)
}
dotfiles() {
(cd "$(chezmoi source-path)" && nvim "$@") || true
}
extract() {
case $1 in
*.tar.gz | *.tgz) tar xzvf "$1" ;;
*.tar.xz) tar Jxvf "$1" ;;
*.zip) unzip "$1" ;;
*.lzh) lha e "$1" ;;
*.tar.bz2 | *.tbz) tar xjvf "$1" ;;
*.tar.Z) tar zxvf "$1" ;;
*.gz) gzip -d "$1" ;;
*.bz2) bzip2 -dc "$1" ;;
*.Z) uncompress "$1" ;;
*.tar) tar xvf "$1" ;;
*.arj) unarj "$1" ;;
*) echo "'$1' cannot be extracted via extract()" ;;
esac
}
randstr() {
LC_ALL=C tr -dc 'a-zA-Z0-9' </dev/urandom | fold -w "${1:-32}" | head -n 1
}
#==============================================================#
## ALIASES ##
#==============================================================#
alias d="dotfiles"
alias c="chezmoi"
alias gs='git status'
alias k='kubectl'
alias kx='kubectx'
alias kn='kubens'
alias rust-repl='evcxr'
alias awsume=". awsume"
alias ls="ls --color=auto"
alias la='ls -lAFh'
alias lr='ls -tRFh'
alias lt='ls -ltFh'
alias ll='ls -l'
alias ldot='ls -ld .*'
alias lS='ls -1FSsh'
alias grep='grep --color'
alias sgrep='grep -R -n -H -C 5 --exclude-dir={.git,.svn,CVS} '
alias unexport='unset'
alias dud='du -d 1 -h'
alias ff='find . -type f -name'
alias fd='find . -type d -name'
alias ..='cd ..'
alias ...='cd ../..'
alias ....='cd ../../..'
alias .....='cd ../../../..'
alias path='echo -e ${PATH//:/\\n}'
alias now='date +"%T"'
alias nowtime=now
alias nowdate='date +"%d-%m-%Y"'
#==============================================================#
## Optional Sources ##
#==============================================================#
if [ -f "${HOME}/.profile.local" ]; then
# shellcheck disable=SC1091
. "${HOME}/.profile.local"
fi
if [ -d "${HOME}/.profile.d" ]; then
for file in "${HOME}/.profile.d/"*.sh; do
if [ -f "${file}" ]; then
# shellcheck disable=SC1090
. "${file}"
fi
done
fi