-
Notifications
You must be signed in to change notification settings - Fork 15
/
exports
365 lines (292 loc) · 10.1 KB
/
exports
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
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
#!/usr/bin/env bash
# bash/exports
# ---
# github.com/rafi/.config
# References:
# - https://github.com/milomouse/dotfiles
# - https://github.com/EvanPurkhiser/dots-personal
# - https://github.com/davidosomething/dotfiles
# - https://wiki.archlinux.org/index.php/XDG_Base_Directory_support
# shellcheck disable=1091
export LANG="en_US.UTF-8"
export LC_CTYPE="$LANG"
export LC_ALL="$LANG"
# XDG directories
export XDG_CONFIG_HOME="$HOME/.config"
export XDG_CACHE_HOME="$HOME/.cache"
export XDG_DATA_HOME="$HOME/.local/share"
export XDG_STATE_HOME="$HOME/.local/state"
[ -d "$XDG_CONFIG_HOME" ] || mkdir -m 0750 "$XDG_CONFIG_HOME"
[ -d "$XDG_CACHE_HOME" ] || mkdir -m 0750 "$XDG_CACHE_HOME"
[ -d "$XDG_DATA_HOME" ] || mkdir -m 0750 "$XDG_DATA_HOME"
[ -d "$XDG_STATE_HOME" ] || mkdir -m 0750 "$XDG_STATE_HOME"
# Source .env file is exists
[ -f "$XDG_CONFIG_HOME/.env" ] && source "$XDG_CONFIG_HOME/.env"
# macOS
if [[ "$OSTYPE" == "darwin"* ]]; then
PREFIX="${HOMEBREW_PREFIX:-/opt/homebrew}"
[ ! -d "$PREFIX" ] && PREFIX="/usr/local"
export PREFIX
export BROWSER=open
export XINITRC="$XDG_CONFIG_HOME"/xorg/xinitrc_osx
# export XDG_RUNTIME_DIR="$XDG_CACHE_HOME/run"
# [ -d "$XDG_RUNTIME_DIR" ] || mkdir -m 0700 "$XDG_RUNTIME_DIR"
# Ensure Homebrew-provided packages are used instead of system's.
export PATH="$PREFIX/bin:$PREFIX/sbin:$PATH"
# Linux
else
export PREFIX=/usr
export BROWSER=/usr/bin/google-chrome-stable
export XAUTHORITY="$XDG_CACHE_HOME/Xauthority"
export XINITRC="$XDG_CONFIG_HOME"/xorg/xinitrc
# Set the systemd-style DBUS address
# export DBUS_SESSION_BUS_ADDRESS=unix:path=$XDG_RUNTIME_DIR/bus
fi
# Local bin
PATH="$HOME/.local/bin:$PATH:bin"
# History settings
export HISTSIZE=20000
if [ "$BASH" ]; then
export HISTFILE="$XDG_CACHE_HOME/bash_history"
export HISTFILESIZE=15000000
export HISTTIMEFORMAT='[%F %T] '
export HISTIGNORE='pwd:jobs:ll:ls:l:history:c:clear'
export HISTCONTROL=ignoreboth
# export HISTCONTROL='ignoreboth:erasedups'
# Append to history and set the window title as 'user@host:dir'
# export PROMPT_COMMAND="history -a; ${PROMPT_COMMAND}"
# export PROMPT_COMMAND='history -a; echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD}\007"'
elif [ "$ZSH_VERSION" ]; then
export HISTFILE="${XDG_CACHE_HOME}/zsh_history"
export SAVEHIST="${HISTSIZE}"
fi
# Editor
EDITOR=vim
if hash nvim 2>/dev/null; then
export MANPAGER="nvim +'set cmdheight=2' +Man!"
EDITOR=nvim
fi
export EDITOR
export VISUAL="$EDITOR"
# Desktop and shells
# ----
# https://www.gnu.org/software/bash/manual/html_node/Readline-Init-File.html
export INPUTRC="$XDG_CONFIG_HOME/bash/inputrc"
# Zsh
export ZDOTDIR="$XDG_CONFIG_HOME/zsh"
# export RXVT_SOCKET="$XDG_RUNTIME_DIR/urxvtd"
export URXVT_PERL_LIB="$XDG_CONFIG_HOME/urxvt/ext"
# Look for terminfo files under data and find system collections
if [ -d "$XDG_DATA_HOME/terminfo" ]; then
export TERMINFO="$XDG_DATA_HOME/terminfo"
export TERMINFO_DIRS="$TERMINFO"
if [ -d "$PREFIX/share/terminfo" ]; then
export TERMINFO_DIRS="$TERMINFO_DIRS:$PREFIX/share/terminfo"
fi
if [ -d "$PREFIX/opt/ncurses/share/terminfo" ]; then
export TERMINFO_DIRS="$TERMINFO_DIRS:$PREFIX/opt/ncurses/share/terminfo"
fi
fi
# Forces QT to use GTK icons
export DESKTOP_SESSION=gnome
# Pull GTK2 RC files from the standard config location, similar to gtk-3.0
[ -e /etc/gtk-2.0 ] && export GTK2_RC_FILES="$XDG_CONFIG_HOME/gtk-2.0/gtkrc"
# Set the session ssh-agent socket path (If it's not set)
# [ -z "$SSH_AUTH_SOCK" ] && export SSH_AUTH_SOCK="$XDG_RUNTIME_DIR/ssh-agent"
# See: https://github.com/tmux-python/tmuxp
export TMUXP_CONFIGDIR="$XDG_CONFIG_HOME/tmuxp"
# Pagers
# ----
export PAGER=less
export LESS="-FiQMXRW --incsearch"
export LESSCHARSET="UTF-8"
export LESSHISTFILE="$XDG_CACHE_HOME/less_history"
export LESSKEY="$XDG_CONFIG_HOME/lesskey/output"
# On newer versions of less, use the following to support Nerdfonts.
export LESSUTFCHARDEF="E000-F8FF:p,F0000-FFFFD:p,100000-10FFFD:p"
# Finders
# ----
# Ripgrep https://github.com/BurntSushi/ripgrep
export RIPGREP_CONFIG_PATH="$XDG_CONFIG_HOME/ripgrep/rc"
# Cointop TODO: deprecated
export COINTOP_CONFIG="$XDG_CONFIG_HOME/cointop/config.toml"
# Ack configuration
if hash ack 2> /dev/null; then
export ACKRC="$XDG_CONFIG_HOME/ack/ackrc"
export ACK_PAGER_COLOR="less -x4SRFX"
fi
export INTELLI_HOME="$XDG_STATE_HOME/intellishell"
export INTELLI_SKIP_ESC_BIND=1
# jk
if hash jk 2>/dev/null; then
export JK_DIRS="$XDG_DATA_HOME/tldr:$HOME/docs/cheatsheets"
fi
# Prompt
# ----
export STARSHIP_CONFIG="$XDG_CONFIG_HOME/starship/config.toml"
# Security and Productivity
# ----
# https://www.gnupg.org/documentation/manuals/gnupg/GPG-Configuration.html
export GNUPGHOME="$XDG_CONFIG_HOME/gnupg"
export PASSWORD_STORE_DIR="$HOME/docs/pass/"
export WEGORC="$XDG_CONFIG_HOME/wego/config"
export WAKATIME_HOME="$XDG_DATA_HOME/wakatime"
hash sshrc 2>/dev/null && export SSHHOME="$XDG_CONFIG_HOME/sshrc"
# Task warrior configuration
if hash task 2>/dev/null
then
export TASKRC="$XDG_CONFIG_HOME/task/config"
export TASKDATA="$XDG_DATA_HOME/task"
fi
# Cloud and mobile development
# ----
# Amazon AWS
export AWS_CONFIG_FILE="${HOME}/docs/aws/config"
export AWS_SHARED_CREDENTIALS_FILE="${HOME}/docs/aws/credentials"
# Google Cloud SDK
export USE_GKE_GCLOUD_AUTH_PLUGIN=True
export CLOUDSDK_CONFIG="$XDG_STATE_HOME/gcloud"
# Bash only
if [ -n "$BASH_VERSION" ]; then
if [ -f "$PREFIX/share/google-cloud-sdk/path.bash.inc" ]; then
source "$PREFIX/share/google-cloud-sdk/path.bash.inc"
fi
fi
# Android SDK and tools
if [ -d "${HOME}/Library/Android/sdk" ]; then
export ANDROID_SDK_HOME="$XDG_DATA_HOME"/android
export ANDROID_HOME="${HOME}/Library/Android/sdk"
PATH="${PATH}:${ANDROID_HOME}/tools"
PATH="${PATH}:${ANDROID_HOME}/platform-tools"
fi
# Downloaders
# ----
# cURL .netrc location
if [ -d "$HOME/docs/netrc" ]; then
export CURLOPT_NETRC_FILE="$HOME/docs/netrc/config"
fi
hash http 2>/dev/null && export HTTPIE_CONFIG_DIR="$XDG_CONFIG_HOME/httpie"
if [ -f "$XDG_CONFIG_HOME/wget/config" ]; then
export WGETRC="$XDG_CONFIG_HOME/wget/config"
fi
# Virtualization
# ----
# Lima https://github.com/lima-vm/lima
export LIMA_HOME="$XDG_DATA_HOME/lima"
# Packer
export PACKER_CACHE_DIR="$XDG_CACHE_HOME/packer"
# Vagrant
export VAGRANT_HOME="$XDG_DATA_HOME/vagrant"
# Databases
# ----
# PostgreSQL CLI utilities
export PSQLRC="$XDG_CONFIG_HOME/psql/config"
export PGCLIRC="$XDG_CONFIG_HOME/pgcli/config"
# MySQL
export MYSQL_HISTFILE="$XDG_CACHE_HOME/mysql_history"
# SQLite
export SQLITE_HISTORY="$XDG_CACHE_HOME/sqlite_history"
# Kubernetes
# ----
hash minikube 2>/dev/null && export MINIKUBE_HOME="$XDG_DATA_HOME/minikube"
if hash kubectl 2>/dev/null; then
export KUBECTL_EXTERNAL_DIFF='diff -u -N --color=always'
export KREW_ROOT="$XDG_DATA_HOME/krew"
PATH="${KREW_ROOT:-$HOME/.krew}/bin:$PATH"
fi
# Media
# ----
hash gimp 2>/dev/null && export GIMP2_DIRECTORY="$XDG_CONFIG_HOME/gimp-2.8"
hash mplayer 2>/dev/null && export MPLAYER_HOME="$XDG_CONFIG_HOME/mplayer"
hash mpv 2>/dev/null && export MPV_HOME="$XDG_CONFIG_HOME/mpv"
# Remote/local MPD host
export MPD_HOST="music.host"
# export MPDCRON_DIR="$XDG_CONFIG_HOME/mpdcron"
# Data
# ----
# nextword https://github.com/high-moctane/nextword
export NEXTWORD_DATA_PATH="$XDG_DATA_HOME/nextword"
# Programming Languages
# ----
# Lua and Luarocks user config
# export LUAROCKS_CONFIG="$XDG_CONFIG_HOME/luarocks/config.lua"
# export LUA_PATH="$XDG_DATA_HOME/lua/5.3/share/lua/5.3/?.lua"
# export LUA_PATH="${LUA_PATH};${XDG_DATA_HOME}/lua/5.3/share/lua/5.3/?/init.lua;;"
# export LUA_CPATH="$XDG_DATA_HOME/lua/5.3/lib/lua/5.3/?.so;;"
# Go configuration
if hash go 2>/dev/null; then
export GOPATH="$XDG_DATA_HOME"/go
PATH="$PATH:$GOPATH/bin"
fi
# Node NPM tool configuration
if hash npm 2>/dev/null; then
export NPM_CONFIG_USERCONFIG="$XDG_CONFIG_HOME/npm/npmrc"
# export N_PREFIX="${XDG_DATA_HOME}/node"
# PATH="${N_PREFIX}/bin:$PATH:${XDG_DATA_HOME}/npm/bin"
fi
if hash yarn 2>/dev/null; then
PATH="$XDG_DATA_HOME/yarn/global/node_modules/.bin/:$PATH"
fi
# Babel
# export BABEL_CACHE_PATH="$XDG_CACHE_HOME/babel.json"
# Node.js configuration
if hash node 2>/dev/null; then
if [[ "$OSTYPE" == "darwin"* ]]; then
export NODE_EXTRA_CA_CERTS="$PREFIX"/etc/ca-certificates/cert.pem
fi
fi
# PHP
export COMPOSER_HOME="$XDG_CACHE_HOME/composer"
# Python
export PYTHON_COLORS=1
export PYTHON_HISTORY="$XDG_CACHE_HOME/python_history"
# Python utilities
export PYLINTHOME="$XDG_CACHE_HOME/pylint"
export IPYTHONDIR="$XDG_CONFIG_HOME"/ipython
#export JUPYTER_CONFIG_DIR="$XDG_CONFIG_HOME"/jupyter
# Virtualenv managers
export RYE_HOME="$XDG_DATA_HOME/python/rye"
export WORKON_HOME="$XDG_DATA_HOME/python/envs"
export PIPSI_HOME="$WORKON_HOME"
export POETRY_VIRTUALENVS_PATH="$XDG_DATA_HOME"/python/poetry
export POETRY_CONFIG_DIR="$XDG_CONFIG_HOME"/pypoetry
export POETRY_DATA_DIR="$XDG_DATA_HOME"/pypoetry
export POETRY_CACHE_DIR="$XDG_CACHE_HOME"/pypoetry
# pipx https://github.com/pypa/pipx
if hash pipx 2>/dev/null; then
export PIPX_HOME="$XDG_DATA_HOME/python/pipx"
export PIPX_BIN_DIR="$XDG_DATA_HOME/python/pipx/bin"
PATH="${PIPX_BIN_DIR}:${PATH}"
fi
# Rust Cargo configuration
if hash cargo 2>/dev/null; then
export RUSTUP_HOME="$XDG_DATA_HOME"/rustup
export CARGO_HOME="$XDG_DATA_HOME"/cargo
PATH="$XDG_DATA_HOME/cargo/bin:$PATH"
fi
# CPAN configuration
if hash cpan 2>/dev/null; then
export PERL5LIB="$HOME/.local/lib/perl5${PERL5LIB+:}${PERL5LIB}"
export PERL_LOCAL_LIB_ROOT="$HOME/.local${PERL_LOCAL_LIB_ROOT+:}${PERL_LOCAL_LIB_ROOT}"
export PERL_MB_OPT="--install_base \"$HOME/.local\""
export PERL_MM_OPT="INSTALL_BASE=$HOME/.local"
hash cpanm 2>/dev/null && export PERL_CPANM_OPT="-l $HOME/.local"
fi
# Always install ruby gems local to the user
if hash gem 2>/dev/null; then
if [ -d "$PREFIX/opt/ruby/bin" ]; then
PATH="$PREFIX/opt/ruby/bin:$PATH"
fi
export GEMRC="$XDG_CONFIG_HOME/gemrc/config"
export GEM_SPEC_CACHE="$XDG_CACHE_HOME/gem/specs"
# export GEM_HOME="$HOME/.local/lib/ruby/gems/$(ruby -e 'puts RbConfig::CONFIG["ruby_version"]')"
# PATH="$PATH:$GEM_HOME/bin"
fi
# Haskell cabal configuration
if hash cabal 2>/dev/null; then
PATH="$PATH:$HOME/.cabal/bin"
fi
unset PREFIX
# Export the final PATH
export PATH
# vim: set ft=sh ts=2 sw=2 tw=80 noet :