-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcommon
More file actions
287 lines (233 loc) · 8.85 KB
/
Copy pathcommon
File metadata and controls
287 lines (233 loc) · 8.85 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
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
#!/bin/sh
# This represents a universal config file for environment setup and preferences.
# Load this with a login shell.
# To override, create an overrides file which will be sourced at the end.
# Source this file
# ln -s ~/.config/profile/common ~/.profile
# OR
# ~/.profile: [ -e "~/.config/profile/common" ] && . "~/.config/profile/common"
# "$ZDOTDIR"/.zprofile: [ -e ~/.profile ] && emulate sh -c 'source ~/.profile'
# add .local/bin to path
export PATH="$HOME/.local/bin:$PATH"
# add local golang to path, if present
export PATH="/usr/local/lib/go/bin:/usr/local/go/bin:$PATH"
## Locale
export LANG=en_US.utf8
export LANGUAGE="en_US:en:C"
# In theory, list prefered languages in order
# For whatever reason, Fedora at least will grab swedish for application and categroty names (but not message text) if sv[_SE] appears anywhere in the list
# export LANGUAGE="en_US:en:C:sv_SE:sv"
export LC_ADDRESS=sv_SE.UTF-8
#export LC_ADDRESS=en_US.UTF-8
export LC_COLLATE=C.UTF-8
export LC_CTYPE=en_US.UTF-8
export LC_IDENTIFICATION=sv_SE.UTF-8
#export LC_IDENTIFICATION=en_US.UTF-8
export LC_MEASUREMENT=sv_SE.UTF-8
#export LC_MEASUREMENT=en_US.UTF-8
export LC_MESSAGES=en_US.UTF-8
export LC_MONETARY=en_US.UTF-8
export LC_NAME=en_US.UTF-8
export LC_NUMERIC=en_US.UTF-8
export LC_PAPER=sv_SE.UTF-8
#export LC_PAPER=en_US.UTF-8
export LC_TELEPHONE=sv_SE.UTF-8
#export LC_TELEPHONE=en_US.UTF-8
export LC_TIME=C.UTF-8
## Application defaults
export EDITOR="nano"
if hash kitty 2>/dev/null; then
export TERMINAL="kitty"
elif hash tilix 2>/dev/null; then
export TERMINAL="tilix"
fi
export BROWSER="firefox"
if hash gnome-text-editor 2>/dev/null; then
export KUBE_EDITOR="gnome-text-editor"
elif hash gedit 2>/dev/null; then
export KUBE_EDITOR="gedit"
fi
export XDG_CONFIG_HOME="$HOME/.config"
export XDG_DATA_HOME="$HOME/.local/share"
export XDG_CACHE_HOME="$HOME/.cache"
# Add inherent scroll support to less / bat as desired
# Means less will handle scrolling instead of the terminal emulator, which is
# required for scrolling in tmux to work (only works for graphical sessions).
# However, if less takes control of the cursor, it is no longer possible to
# highlight and copy text from the terminal emulator.
export LESS="-RF"
if [ "$(less --version | head --lines=1 | grep --only-matching -E "[0-9]+")" -ge 549 ]; then
# export LESS="-RF --mouse --wheel-lines=5"
export BAT_PAGER="less -RF --mouse --wheel-lines=5"
export DELTA_PAGER="$BAT_PAGER"
fi
## Application configs
# Exa
# Make the detailed view less of a rainbow
if [ -e "${XDG_CONFIG_HOME:-$HOME/.config}"/exa/colors.cnf ]; then
# Combine non-commented lines
export EXA_COLORS="$(grep --extended-regexp --only-matching "^[^# $(printf '\t')]+" "${XDG_CONFIG_HOME:-$HOME/.config}"/exa/colors.cnf | tr '\n' ':')"
fi
export EXA_STRICT=true
export TIME_STYLE="long-iso"
# For more Exa features, see: https://the.exa.website/features.
# You can also study my Dotfiles project: https://www.alchemists.io/projects/dotfiles.
# ☿ 🜔 🜍 🜂 🜃 🜁 🜄
# Initialize color-scheme files
find "${XDG_DATA_HOME:-"$HOME"/.config}/color-scheme/scripts" -maxdepth 1 -type f -exec sh -c '
if ! "$1" --init >/dev/null 2>&1; then echo "Failed to run $1 --init"; fi
' sh {} \;
## ~/ cleanup (may need to create these folders / files manually)
# Check here for updates: https://wiki.archlinux.org/index.php/XDG_Base_Directory
# anaconda (python)
export CONDARC="$XDG_CONFIG_HOME/conda/condarc"
# Anki
# Anki is natively supported now, according to https://apps.ankiweb.net/docs/manual20.html#file-locations
# Ansible
export ANSIBLE_HOME="${XDG_CONFIG_HOME}/ansible"
export ANSIBLE_CONFIG="${XDG_CONFIG_HOME}/ansible.cfg"
export ANSIBLE_GALAXY_CACHE_DIR="${XDG_CACHE_HOME}/ansible/galaxy_cache"
# The remote's ~/.ansible/tmp can be moved by setting remote_tmp = ${XDG_CONFIG_HOME}/ansible/tmp in an appropriate ansible.cfg.
# Atom
export ATOM_HOME="$XDG_DATA_HOME"/atom
# AWS cli
export AWS_SHARED_CREDENTIALS_FILE="$XDG_CONFIG_HOME"/aws/credentials
export AWS_CONFIG_FILE="$XDG_CONFIG_HOME"/aws/config
# Bash Completion
export BASH_COMPLETION_USER_FILE="$XDG_CONFIG_HOME"/bash-completion/bash_completion
# Ruby bundler
export BUNDLE_USER_CONFIG="$XDG_CONFIG_HOME"/bundle
export BUNDLE_USER_CACHE="$XDG_CACHE_HOME"/bundle
export BUNDLE_USER_PLUGIN="$XDG_DATA_HOME"/bundle
# Rust cargo
export CARGO_HOME="$XDG_DATA_HOME"/cargo
# Conky
# Conky is natively supported now
# Docker
export DOCKER_CONFIG="$XDG_CONFIG_HOME/docker"
# FFmpeg
export FFMPEG_DATADIR="$XDG_CONFIG_HOME"/ffmpeg
# GDB
#if which gdb >/dev/null 2>&1; then
# gdb () {
# "$(which gdb)" -nh -x "$XDG_CONFIG_HOME"/gdb/init "$@"
# }
#}
# GnupPG
# Also requires modifying systemd unit files
# export GNUPGHOME="$XDG_DATA_HOME/gnupg"
# mkdir -p "$GNUPGHOME"
# GoLang
# GOPATH is largely replaced by go modules, but is still a fallback
export GOPATH="$XDG_DATA_HOME"/go
# GO build cache (defaults to $XDG_CACHE_HOME/go-build)
export GOCACHE="$XDG_CACHE_HOME"/go/build
# GO module cache (defaults to $GOPATH/pkg)
export GOMODCACHE="$XDG_CACHE_HOME"/go/mod
# GO binary install dir (defaults to $GOPATH/bin)
export GOBIN="$HOME/.local/bin"
mkdir -p "$GOPATH" "$GOCACHE" "$GOMODCACHE" "$GOBIN"
# Gradle
export GRADLE_USER_HOME="$XDG_DATA_HOME"/gradle
# GTK
export GTK_RC_FILES="$XDG_CONFIG_HOME"/gtk-1.0/gtkrc
export GTK2_RC_FILES="$XDG_CONFIG_HOME"/gtk-2.0/gtkrc
# Java (OpenJDK)
# export _JAVA_OPTIONS=-Djava.util.prefs.userRoot="$XDG_CONFIG_HOME"/java
# KDE
export KDEHOME="$XDG_CONFIG_HOME"/kde
# Kodi
export KODI_DATA="$XDG_DATA_HOME/kodi"
# Kubectl
export KUBECONFIG="$XDG_CONFIG_HOME"/kube/config
export KUBECACHEDIR="$XDG_CACHE_HOME"/kube
# Less
mkdir -p "$XDG_CACHE_HOME"/less
export LESSHISTFILE="$XDG_CACHE_HOME/less/history"
export LESSKEY="$XDG_DATA_HOME/less/lesskey"
# LibX11
export XCOMPOSEFILE="$XDG_CONFIG_HOME"/X11/xcompose
export XCOMPOSECACHE="$XDG_CACHE_HOME"/X11/xcompose
# Maven
# More work than it's worth to change (other apps may still use .m2 anyway)
# Cannot be set via env; requires the settings flag and the following settings:
# <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
# xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 https://maven.apache.org/xsd/settings-1.0.0.xsd">
# <localRepository>${env.XDG_DATA_HOME}/maven</localRepository>
# </settings>
# if which mvn >/dev/null 2>&1; then
# mvn () {
# "$(which mvn)" -gs "$XDG_CONFIG_HOME"/maven/settings.xml
# }
# }
# NodeJS
export NODE_REPL_HISTORY="$XDG_DATA_HOME"/node_repl_history
# npm
# Requires the following npmrc content:
# prefix=${XDG_DATA_HOME}/npm
# cache=${XDG_CACHE_HOME}/npm
# tmp=${XDG_RUNTIME_DIR}/npm
# init-module=${XDG_CONFIG_HOME}/npm/config/npm-init.js
export NPM_CONFIG_USERCONFIG="$XDG_CONFIG_HOME"/npm/npmrc
# Nuget
export NUGET_PACKAGES="$XDG_CACHE_HOME"/NuGetPackages
# NVM
export NVM_DIR="$XDG_DATA_HOME"/nvm
# pass
export PASSWORD_STORE_DIR="$XDG_DATA_HOME/password-store"
# PSQL
mkdir -p "$XDG_CONFIG_HOME/pg"
mkdir -p "$XDG_CACHE_HOME/pg"
export PSQLRC="$XDG_CONFIG_HOME/pg/psqlrc"
export PSQL_HISTORY="$XDG_CACHE_HOME/pg/psql_history"
export PGPASSFILE="$XDG_CONFIG_HOME/pg/pgpass"
export PGSERVICEFILE="$XDG_CONFIG_HOME/pg/pg_service.conf"
# Python
export PYTHON_EGG_CACHE="$XDG_CACHE_HOME"/python-eggs
export PYLINTHOME="$XDG_CACHE_HOME"/pylint
# GNU Readline
export INPUTRC="$XDG_CONFIG_HOME"/readline/inputrc
# Ruby Gems
# Auto-generates a gemrc to set the bin dir to $XDG_DATA_HOME/gem/bin
# XDG_DATA_HOME must not contain spaces
export GEMRC="$XDG_CONFIG_HOME"/gemrc
export GEM_HOME="$XDG_DATA_HOME"/gem
export PATH="$PATH:$GEM_HOME/bin"
export GEM_SPEC_CACHE="$XDG_CACHE_HOME"/gem
if ! [ -e "$XDG_CONFIG_HOME"/gemrc ]; then
echo "gem: --bindir $GEM_HOME/bin" > "$GEMRC"
fi
# Rust up
export RUSTUP_HOME="$XDG_DATA_HOME"/rustup
# SBT
# more work than it's worth to fix, due to dependent tools
# Teamspeak
# Disabled to avoid breaking flatpak installations
# export TS3_CONFIG_DIR="$XDG_CONFIG_HOME/ts3client"
# Tmux Smart Session Manager
if [ -d "$XDG_DATA_HOME/tmux-plugins/t-smart-tmux-session-manager/bin" ]; then
export PATH="$PATH:$XDG_DATA_HOME/tmux-plugins/t-smart-tmux-session-manager/bin"
fi
# GNU Screen
export SCREENRC="$XDG_CONFIG_HOME"/screen/screenrc
# vale
#if which vale >/dev/null 2>&1; then
# vale () {
# "$(which vale)" --config "$XDG_CONFIG_HOME/vale/config.ini" "$@"
# }
#}
# Vim (requires specific content in VIMRC, see the wiki)
export VIMINIT='source "$XDG_CONFIG_HOME/vim/vimrc"'
# wget
# Add to wgetrc: hsts-file="$XDG_CACHE_HOME"/wget-hsts
export WGETRC="$XDG_CONFIG_HOME/wget/wgetrc"
# Wine
mkdir -p "$XDG_DATA_HOME"/wineprefixes
export WINEPREFIX="$XDG_DATA_HOME"/wineprefixes/default
# ZOXIDE
export _ZO_DATA_DIR="$XDG_CACHE_HOME"/zoxide
# ZSH
# Should be done in ~/.zshenv instead, since it is first in the load order
# export ZDOTDIR="$XDG_CONFIG_HOME"/zsh
## Overrides
[ -e "$XDG_CONFIG_HOME/profile/override" ] && . "$XDG_CONFIG_HOME/profile/override"