-
Notifications
You must be signed in to change notification settings - Fork 0
/
.zshenv
123 lines (95 loc) · 2.92 KB
/
.zshenv
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
# Load secret environment variables
[[ -f "$HOME/dotfiles/env" ]] && source "$HOME/dotfiles/env"
[[ -f "$HOME/.envrc" ]] && source "$HOME/.envrc"
export OS="$(uname -s)"
# default browser
if [[ "$OS" = "Darwin" ]]; then
export BROWSER="/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome"
else
export BROWSER="chromium"
fi
# default editor
export EDITOR="nvim"
export VISUAL="nvim"
# XDG_CONFIG
export XDG_DATA_HOME="$HOME/.local/share"
export XDG_CONFIG_HOME="$HOME/dotfiles/config"
# Shortcuts
export BIN=$HOME/bin
export CONFIG="$XDG_CONFIG_HOME"
export DOT="$HOME/dotfiles"
export DOWNLOADS="$HOME/downloads"
export POLYBAR="$CONFIG/polybar"
export NVIM="$CONFIG/nvim"
export ACCOUNTING="$HOME/tmp/accounting"
export PRIVATE_VAULT="$HOME/Documents/shopify"
export PUBLIC_VAULT="$HOME/Documents/public"
# completions path
# ! [ -z "${fpath+x}" ] && export fpath=($BIN/completions $fpath)
# ruby
export GEM_HOME=$HOME/.gems
# go-jira
if [[ -d $HOME/.jira.d ]]; then
export JIRA=$HOME/.jira.d
fi
# go path
export GOPATH="$HOME/go"
_path_append() {
if ! [[ $PATH == *"$1"* ]] && [[ -e "$1" || "$2" = '-f' ]]; then
export PATH="$PATH:$1"
fi
}
_path_prepend() {
if ! [[ $PATH == *"$1"* ]] && [[ -e "$1" || "$2" = '-f' ]]; then
export PATH="$1:$PATH"
fi
}
# base path
if [[ "$OS" = "Darwin" ]]; then
export PATH="/opt/local/bin:/opt/local/sbin:$HOME/npm/bin:/usr/local/bin:/bin:/usr/sbin:/sbin:/usr/bin:/usr/texbin"
elif [[ "$SPIN" ]]; then
export PATH="$PATH"
elif [[ "$OS" = "Linux" ]]; then
export PATH="/usr/local/sbin:/usr/local/bin:/usr/bin"
fi
# mac stuff
if [[ "$OS" = "Darwin" ]]; then
# Do weird nix shit to the $PATH
[[ -f "/opt/dev/dev.sh" ]] && source /opt/dev/dev.sh
if [[ -e "$HOME/.nix-profile/etc/profile.d/nix.sh" ]]; then . $HOME/.nix-profile/etc/profile.d/nix.sh; fi
# Prefer GNU commands to BSD
export PATH="/usr/local/opt/coreutils/libexec/gnubin:$PATH"
# Prefer brew python to system python
export PATH="/opt/homebrew/opt/python/libexec/bin:$PATH"
# Add brew bin
local brewprefix=/opt/homebrew
_path_append "$brewprefix/bin"
# Add GNU man pages
export MANPATH="/usr/local/opt/coreutils/libexec/gnuman:$MANPATH"
# add vscode code
export PATH="$PATH:/Applications/Visual Studio Code.app/Contents/Resources/app/bin"
fi
# prefer node_module bin
_path_prepend "node_modules/.bin" -f
_path_prepend "../../node_modules/.bin" -f
# prefer $HOME/bin
_path_prepend "$HOME/bin" -f
[[ $SPIN ]] && _path_prepend "$HOME/binbin" -f
# add local bin
_path_append "bin" -f
# global yarn scripts
_path_append "$HOME/.config/yarn/global/node_modules/.bin"
# yarn / nvm
_path_append "$HOME/.yarn/bin"
# ruby gems
_path_append "$HOME/.gem/ruby/2.5.7/bin"
# ruby gems GEM_HOME
_path_append "$GEM_HOME/bin"
# python user bin
_path_append "$HOME/.local/bin"
# go stuff
_path_append "$GOPATH/bin"
# Source aliases
if [[ "$(basename "$SHELL")" = "zsh" ]]; then
source "$DOT/.zsh_custom/aliases.zsh"
fi