/
profile.sh.tmpl
150 lines (135 loc) · 4.83 KB
/
profile.sh.tmpl
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
#!/usr/bin/env sh
# @file Shared Profile
# @brief Main shell profile that is used to combine the shared profile configurations that are used by both the `~/.bashrc` and `~/.zshrc` files
# @description
# This script is included by `~/.bashrc` and `~/.zshrc` to include imports and settings that are common to both the Bash
# and ZSH shells.
# shellcheck disable=SC1090,SC1091,SC2016
# Aliases / Functions / Exports
export XDG_CONFIG_HOME="${XDG_CONFIG_HOME:-$HOME/.config}"
[ ! -f "${XDG_CONFIG_HOME:-$HOME/.config}/shell/exports.sh" ] || . "${XDG_CONFIG_HOME:-$HOME/.config}/shell/exports.sh"
[ ! -f "${XDG_CONFIG_HOME:-$HOME/.config}/shell/aliases.sh" ] || . "${XDG_CONFIG_HOME:-$HOME/.config}/shell/aliases.sh"
[ ! -f "${XDG_CONFIG_HOME:-$HOME/.config}/shell/functions.sh" ] || . "${XDG_CONFIG_HOME:-$HOME/.config}/shell/functions.sh"
[ ! -f "${XDG_CONFIG_HOME:-$HOME/.config}/shell/apps.sh" ] || . "${XDG_CONFIG_HOME:-$HOME/.config}/shell/apps.sh"
[ ! -f "${XDG_CONFIG_HOME:-$HOME/.config}/shell/docker.sh" ] || . "${XDG_CONFIG_HOME:-$HOME/.config}/shell/docker.sh"
### Bash / ZSH
if [ "$BASH_SUPPORT" = 'true' ]; then
### OS Detection
if [ -f /etc/os-release ]; then
. /etc/os-release
if [ "$ID" = 'alpine' ]; then
OS_ICON=""
elif [ "$ID" = 'arch' ]; then
OS_ICON=""
elif [ "$ID" = 'centos' ]; then
OS_ICON=""
elif [ "$ID" = 'coreos' ]; then
OS_ICON=""
elif [ "$ID" = 'debian' ]; then
OS_ICON=""
elif [ "$ID" = 'deepin' ]; then
OS_ICON=""
elif [ "$ID" = 'elementary' ]; then
OS_ICON=""
elif [ "$ID" = 'endeavour' ]; then
OS_ICON=""
elif [ "$ID" = 'freebsd' ]; then
OS_ICON=""
elif [ "$ID" = 'gentoo' ]; then
OS_ICON=""
elif [ "$ID" = 'kali' ]; then
OS_ICON=""
elif [ "$ID" = 'linuxmint' ]; then
OS_ICON=""
elif [ "$ID" = 'manjaro' ]; then
OS_ICON=""
elif [ "$ID" = 'nixos' ]; then
OS_ICON=""
elif [ "$ID" = 'openbsd' ]; then
OS_ICON=""
elif [ "$ID" = 'opensuse' ]; then
OS_ICON=""
elif [ "$ID" = 'parrot' ]; then
OS_ICON=""
elif [ "$ID" = 'pop_os' ]; then
OS_ICON=""
elif [ "$ID" = 'raspberry_pi' ]; then
OS_ICON=""
elif [ "$ID" = 'redhat' ]; then
OS_ICON=""
elif [ "$ID" = 'fedora' ]; then
OS_ICON=""
elif [ "$ID" = 'ubuntu' ]; then
OS_ICON=""
else
OS_ICON=""
fi
export OS_ICON
else
if [ -d /Applications ] && [ -d /Library ] && [ -d /System ]; then
# macOS
OS_ICON=""
else
OS_ICON=""
fi
export OS_ICON
fi
### Directory Colors
if [ -f "${XDG_CONFIG_HOME:-$HOME/.config}/shell/lscolors.sh" ]; then
. "${XDG_CONFIG_HOME:-$HOME/.config}/shell/lscolors.sh"
fi
### fzf-git
# if [ -f "${$XDG_DATA_HOME:-$HOME/.local/share}/fzf/fzf-git.bash" ]; then
# . "${$XDG_DATA_HOME:-$HOME/.local/share}/fzf/fzf-git.bash"
# fi
### git-fuzzy
if [ -d "${XDG_DATA_HOME:-$HOME/.local/share}/git-fuzzy/bin" ]; then
export PATH="${XDG_DATA_HOME:-$HOME/.local/share}/git-fuzzy/bin:$PATH"
fi
### MOTD
if [ "$SHOW_MOTD" = 'true' ] && [ -f "${XDG_CONFIG_HOME:-$HOME/.config}/shell/motd.sh" ]; then
. "${XDG_CONFIG_HOME:-$HOME/.config}/shell/motd.sh"
fi
### SUDO_ASKPASS
if [ -d /Applications ] && [ -d /System ]; then
SUDO_ASKPASS="$HOME/.local/bin/sudo-askpass"
fi
fi
### Cargo
if [ -f "$CARGO_HOME/env" ]; then
. "$CARGO_HOME/env"
fi
### Docker Functions / Aliases
# This file is used as an example file since it conflicts with the installation process of many libraries.
# Also, using Firejail is the preferred method of limiting the permissions of a process so there is no need
# to use Docker aliases since Firejail is superior (according to: https://news.ycombinator.com/item?id=21497677)
# if [ -f "$HOME/.local/scripts/docker-functions.bash" ]; then
# . "$HOME/.local/scripts/docker-functions.bash"
# fi
### emsdk
if [ -d "${XDG_DATA_HOME:-$HOME/.local/share}/emsdk" ]; then
export PATH="$PATH:${XDG_DATA_HOME:-$HOME/.local/share}/emsdk"
export EMSDK="${XDG_DATA_HOME:-$HOME/.local/share}/emsdk"
export EMSDK_QUIET=1
fi
### fzf-tmux
# if [ -f "${$XDG_DATA_HOME:-$HOME/.local/share}/fzf/fzf-tmux.bash" ]; then
# . "${$XDG_DATA_HOME:-$HOME/.local/share}/fzf/fzf-tmux.bash"
# fi
### McFly
export MCFLY_PROMPT="❯"
if [ -d /Applications ] && [ -d /System ]; then
if [ "$(defaults read -g AppleInterfaceStyle 2> /dev/null)" != "Dark" ]; then
export MCFLY_LIGHT=TRUE
fi
fi
### Tea
# TODO: Fix this so it does not cause errors as Chezmoi runs
# if command -v tea > /dev/null; then
# source <(tea --magic)
# fi
### VIM
export GVIMINIT='source $MYGVIMRC'
export MYGVIMRC="${XDG_CONFIG_HOME:-$HOME/.config}/vim/gvimrc"
export VIMINIT='source $MYVIMRC'
export MYVIMRC="${XDG_CONFIG_HOME:-$HOME/.config}/vim/vimrc"