-
Notifications
You must be signed in to change notification settings - Fork 0
/
.profile
115 lines (98 loc) · 3.93 KB
/
.profile
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
#!/bin/sh
# I use this file to store environment variables (particularly PATH) for bash,
# zsh, and other shells to read or source.
###############################################################################
###############################################################################
#### PATH ####
###############################################################################
###############################################################################
# These should already be in PATH, but add them to the end if they exist, just
# in case. (Example: /sbin and /usr/sbin are not automatically included in
# macOS.)
paths_append="/usr/local/sbin /usr/bin /bin /sbin /usr/sbin /usr/bin/X11 /usr/games /usr/local/games /opt/homebrew/bin"
for p in $paths_append ; do
case ":$PATH:" in
*":$p:"*)
: # already in PATH; do nothing
;;
*)
# add path if it exists
if [ -d "$p" ] ; then PATH="$PATH:$p" ; fi
;;
esac
done
# These paths are likely not to exist, but should go first if they do. They are
# listed in the reverse order that they'll be in PATH.
paths_prepend="/usr/local/go/bin $HOME/go/bin $HOME/.cargo/bin /snap/bin /usr/local/bin $HOME/.local/bin $HOME/bin"
for p in $paths_prepend ; do
case ":$PATH:" in
*":$p:"*)
: # already in PATH; do nothing
;;
*)
# add path if it exists
if [ -d "$p" ] ; then PATH="$p:$PATH" ; fi
;;
esac
done
###############################################################################
###############################################################################
#### Other Environment Variables ####
###############################################################################
###############################################################################
export TEXMFHOME=~/.texmf
# Set up pyenv if it exists
if [ -d "$HOME/.pyenv" ]; then
export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init --path)"
eval "$(pyenv init -)"
fi
# Set up poetry if it exists
if [ -d "$HOME/.poetry" ]; then
export PATH="$HOME/.poetry/bin:$PATH"
fi
# Set up cargo environment if available
if [ -d "$HOME/.cargo/env" ]; then
. "$HOME/.cargo/env"
fi
# Set up nvm if it exists
if [ -d "$HOME/.nvm" ]; then
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
fi
# Set up volta if it exists
if [ -d "$HOME/.volta" ]; then
export VOLTA_HOME="$HOME/.volta"
export PATH="$VOLTA_HOME/bin:$PATH"
fi
# Use one of the correct editors
if command -v nvim >/dev/null 2>&1; then
export EDITOR=nvim
alias vim=nvim
elif command -v vim >/dev/null 2>&1; then
export EDITOR=vim
else
export EDITOR=vi
fi
###############################################################################
###############################################################################
#### Interactive Shells ####
###############################################################################
###############################################################################
if [ -n "$PS1" ] ; then
# Set up colors for GNU ls
colors="$HOME/.dir_colors/dircolors.ansi-light"
if command -v dircolors >/dev/null 2>&1 ; then
# Set LS_COLORS and alias ls
eval "$(dircolors "$colors")"
alias ls='ls --color=auto'
elif command -v gdircolors >/dev/null 2>&1 ; then
# If only gdircolors exists, this suggests that the system doesn't
# support `--color=auto` (e.g., it's FreeBSD or macOS). Some programs
# might still use $LS_COLORS, though, so run gdircolors anyway.
eval "$(gdircolors "$colors")"
export LSCOLORS=$(python "$HOME/.local/bin/gnu2bsd")
export CLICOLOR=1
fi
fi