-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.sh-env
314 lines (285 loc) · 7.48 KB
/
.sh-env
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
# -*- shell-script -*-
[[ ! -z $DEBUG ]] && echo "sourcing .sh-env"
set -a
# load private variables
[[ -e ~/.sh-env-private ]] && source ~/.sh-env-private
# ***************
# * *
# * ENVIRONMENT *
# * VARIABLES *
# * *
# ***************
export TZ='Australia/Sydney'; # time zone
# ---------------------------
# PATH appending functions.
# ---------------------------
# note: If the path-var is initially empty, the first directory added will be
# appended after the empty string.
# Hence the path-var will begin with separator ":"
append_to_path_var() {
if [[ "$1" =~ "^--?f(ront)?$" ]]; then
shift;
eval "$1=$2:\$$1";
# TODO: remove duplicates from later in list
else
if [ -d "$2" ] && [[ ':$(eval "echo \$$1"):' != *":$2:"* ]]; then
eval "$1=\${$1}:$2";
fi
fi
}
pathappend() {
local dir
# append directory and remove copies from within $PATH
dir="${1%/}"
[[ -d "$dir" ]] && PATH="${PATH//$dir:/}:$dir"
}
pathprepend() {
local dir
# prepend directory and remove copies from within $PATH
dir="${1%/}"
[[ -d "$dir" ]] && PATH="$dir:${PATH//:$dir/}"
}
# ---------
# LOCATIONS
# ---------
# all-caps locations used for settings
# lowercase locations only used as documentation
SH_ALIAS_FILE=$HOME/.sh-aliases
SH_FUNCTION_FILES='~/.sh-functions:~/.sh-functions-find:~/.sh-functions-docs:~/.sh-functions-media'
ZSH_ALIAS_FILE=$HOME/.zsh-aliases
ZSH_FUNCTION_FILE=$HOME/.zsh-functions
BASH_ALIAS_FILE=$HOME/.bash-aliases
BASH_FUNCTION_FILE=$HOME/.bash-functions
SCRIPTS_DIRECTORY=$HOME/.scripts
GTAGSCONF=/usr/share/doc/global/examples/gtags.conf
VIMPAGER_RC=/opt/vimpager/vimpagerrc
SUDO_ASKPASS=/usr/bin/gksu
OZHOME=/usr
REDLINE_HOME=/opt/redline
XDG_CONFIG_HOME=$HOME/.config
ANDROID_HOME='/home/troy/Android/Sdk'
ANDROID_SDK_HOME='/home/troy/.android'
GOPATH=$HOME/gowork
JHOME=/opt/j64-805
SCALA_HOME=/opt/scala-2.12.4
KDE_PLACES_FILE='/home/troy/.local/share/user-places.xbel'
KDE_BOOKMARKS_FILE='/home/troy/.kde/share/apps/kfile/bookmarks.xml'
kde4_system_config_dir='/usr/share/kde4'
kde4_local_config_dirs='~/.kde4/share:~/.kde/share:~/.local/share'
RUST_SRC_PATH='/opt/rust/src'
SSL_CERT_FILE=/etc/ssl/certs/ca-certificates.crt
NODE_PATH='$HOME/.npm-global/lib/node_modules'
# ------
# PATHS.
# ------
ubuntu_default_PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:/usr/games:/usr/local/games
path-set-default() { export PATH=$ubuntu_default_PATH; }
# PATH=$PATH:$ubuntu_default_PATH
PATH=${PATH%:.} # remove . from end of $PATH
paths=(
/opt/texbin
$HOME/bin
$HOME/.local/bin
$HOME/.local/bin/node
$HOME/.linuxbrew/bin
$HOME/.fzf/bin
$HOME/.emacs.d
$HOME/.scripts
$HOME/.scripts/script-directories/*
$HOME/.ghcup/bin
$HOME/.cabal/bin
# /opt/ripgrep/target/release
$HOME/.cargo/bin
$HOME/.cask/bin
$HOME/.lein/bin
$HOME/.nimble/bin
$HOME/.npm-global/bin
$HOME/.rbenv/bin
$HOME/gowork/bin
$HOME/code/working
$HOME/code/scripts
$HOME/.bin-links
$HOME/node_modules/.bin
$HOME/perl5/bin
$ANDROID_HOME/tools
$ANDROID_HOME/platform-tools
${SCALA_HOME:-/opt/scala}/bin
$JHOME/bin
$HOME/.local/share/flatpak/exports/share
$HOME/dotfiles
$HOME/.tridactyl/scripts
/var/lib/flatpak/exports/share
/usr/local/texlive/2014/bin/x86_64-linux
/usr/local/go/bin
/usr/share/vim/vim*/macros
/var/lib/gems/1.8/bin
/opt/icon/bin
/opt/pdfsandich
/opt
/opt/activator-dist/bin
/opt/Amber/bin
/opt/android-studio/bin
/opt/apache-maven-3.3.3/bin
/opt/appimage
/opt/basilisk
/opt/bin
/opt/binlinks
/opt/calibre
/opt/CopyQ
/opt/clean/bin
/opt/eclipse
/opt/epub2pdf
/opt/elasticsearch/bin
/opt/firefox
/opt/gcolor3/src
/opt/google-code-support-tools/googlecode-issues-exporter
/opt/google-code-support-tools/wiki_to_md
/opt/google_appengine/
/opt/helpdeco
/opt/hub/bin
/opt/hy/env/bin
/opt/i2p
/opt/icdiff
/opt/info2html
/opt/jade
/opt/jpdfbookmarks
/opt/julia/bin
/opt/leiningen
/opt/lfe-master/bin
/opt/LightTable
/opt/lilyterm/bin
/opt/mozart2/bin
/opt/MultiMarkdown-6/build
/opt/num-utils-0.5
/opt/palemoon
/opt/pdf-diff
/opt/pdfdir
/opt/peazip
/opt/peazip/res
/opt/phantomjs-2.0.0/bin
/opt/pick
/opt/processing
/opt/racket/bin
/opt/redline
/opt/rstudio/bin
/opt/sbt/bin
/opt/scripts
/opt/sejda-console/bin
/opt/selenium/bin
/opt/smlnj/bin
/opt/SublimeText2
/opt/tor-browser
/opt/tsv-utils/bin
/opt/utorrent-server-v3_0
/opt/waterfox
/opt/wmutils-contrib
/opt/xcape
/opt/xulrunner
/opt/zed
/opt/rakudo/bin
/opt/rakudo/share/perl6/site/bin
/opt/graalvm-ce-java8-21.1.0/bin
)
for i in "${paths[@]}"; do
pathappend "$i"
done
# add rubygem paths
for d in `/usr/bin/gem environment gemdir`/gems/*; do
if [[ -d "$d"/bin ]]; then
pathappend "$d"/bin;
fi
done
prioritypaths=(
/opt/node*/bin
/opt/html-xml-utils-7.2
/opt/bin
$HOME/override
)
for i in "${prioritypaths[@]}"; do
pathprepend "$i"
done
infopaths=(
/usr/share/info
/usr/local/share/info
/opt/info
/opt/emacs*/info
/usr/local/texlive/201?/texmf-dist/doc/info
$HOME/.linuxbrew/share/info
)
for i in "${infopaths[@]}"; do append_to_path_var "INFOPATH" "$i" ; done
manpaths=(
/usr/local/man
/usr/local/texlive/201?/texmf-dist/doc/man
$HOME/.linuxbrew/share/man/
/opt/man/
/opt/racket/man
)
for i in "${manpaths[@]}"; do append_to_path_var "MANPATH" "$i" ; done
cdpaths=(
$HOME
$HOME/.cdpath
$HOME/ebooks
$HOME/Downloads
)
for i in "${cdpaths[@]}"; do append_to_path_var "CDPATH" "$i" ; done
LD_LIBRARY_PATH=/usr/local/lib
CLASSPATH=$CLASSPATH:.
FACTOR_ROOTS=$FACTOR_ROOTS:$HOME/code/factor
DOCPATH=/usr/share/doc:/opt/doc
# ------
# OTHER.
# ------
GREP_COLORS='mt=32;1::sl=:fn=35:ln=32:bn=32:se=36'
unset GREP_COLOR
MANPAGER=less
EDITOR=vim
_JAVA_AWT_WM_NONREPARENTING=1; export _JAVA_AWT_WM_NONREPARENTING
LIBOVERLAY_SCROLLBAR=0
SWEAVE_STYLEPATH_DEFAULT="TRUE"
VIMPAGER_RC=~/.vimpagerrc
# custom environment vars for tridactyl
TRI_REPO_DIR=~/source/git-repos/tridactyl
TRI_SRC_DIR=~/source/git-repos/tridactyl/src
TRI_CONFIG_DIR=~/.tridactyl
# **********
# * *
# * PYTHON *
# * *
# **********
# warning: this can break system python programs - the dirs are
# added near the start of the pythonpath
#PYTHONPATH=$PYTHONPATH:/usr/share/pyshared:$HOME/code/python
#PYTHONPATH=$PYTHONPATH:/usr/share/pyshared
# # ***********
# # * *
# # * CLOJURE *
# # * *
# # ***********
# CLOJURE_EXT=~/.clojure
# pathappend "/opt/clojure-contrib/launchers/bash"
# alias clj=clj-env-dir
# ********
# * *
# * JAVA *
# * *
# ********
# gradle
GRADLE_HOME=/opt/gradle
pathappend $GRADLE_HOME/bin
# -------------------------------------------------------------------------------
# ********
# * *
# * OPAM *
# * *
# ********
# # Load the environment variables
# . /home/troy/.opam/opam-init/variables.sh > /dev/null 2> /dev/null || true
# -------------------------------------------------------------------------------
# # **********
# # * *
# # * NODEJS *
# # * *
# # **********
# source ~/.nvm/nvm.sh
# NPM: set global install directory (actually only needs to be set once)
command -v npm >/dev/null 2>&1 && npm config set prefix '~/.npm-global'