-
Notifications
You must be signed in to change notification settings - Fork 0
/
.zshenv
189 lines (168 loc) · 7.73 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
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
#!/bin/zsh
# shellcheck shell=zsh
# Filename: zshenv
# Purpose: system-wide .zshenv file for zsh(1)
# Authors: grml-team (grml.org), (c) Michael Prokop <[email protected]>
# Bug-Reports: see http://grml.org/bugs/
# License: This file is licensed under the GPL v2.
################################################################################
# This file is sourced on all invocations of the shell.
# It is the 1st file zsh reads; it's read for every shell,
# even if started with -f (setopt NO_RCS), all other
# initialization files are skipped.
#
# This file should contain commands to set the command
# search path, plus other important environment variables.
# This file should not contain commands that produce
# output or assume the shell is attached to a tty.
#
# Notice: .zshenv is the same, execpt that it's not read
# if zsh is started with -f
#
# Global Order: zshenv, zprofile, zshrc, zlogin
################################################################################
if [[ -z "${_ZSH_ORIGINAL_PATH}" ]]; then
export _ZSH_ORIGINAL_PATH="${PATH}"
fi
# export FPATH="${FPATH}:${HOME}/personaldotfiles/zsh/autoload"
if [[ -o interactive ]]; then
if [[ -r /etc/zsh/zprofile ]]; then
source /etc/zsh/zprofile
elif [[ -r /etc/profile ]]; then
source /etc/profile
fi
[[ -r /etc/environment ]] && source /etc/environment
[[ -r /etc/zsh/zshenv ]] && source /etc/zsh/zshenv
[[ -r /etc/zshenv ]] && source /etc/zshenv
# NO FUCKING MANPATHS
[[ -n "$MANPATH" ]] && unset MANPATH
fi
# Get global operating system ID file. If you didn't make one, then MAKE ONE.
if [[ -z "$SYSID" ]]; then
if [[ -r /etc/SYSID ]]; then
export SYSID=$(cat /etc/SYSID)
elif [[ -r /usr/local/etc/SYSID ]]; then
export SYSID=$(cat /usr/local/etc/SYSID)
elif [[ -r "${HOME}/.SYSID" ]]; then
export SYSID=$(cat "${HOME}/.SYSID")
elif [[ -o interactive ]]; then
echo "DEFINE SYSID YOU LAZY PRICK" >&2
fi
fi
# set environment variables (important for autologin on tty)
export HOSTNAME=${HOSTNAME:-$(hostname)}
export PAGER='less'
export EDITOR='nvim'
# make sure /usr/bin/id is available
if [[ -x /usr/bin/id ]] ; then
[[ -z "$USER" ]] && export USER=$(/usr/bin/id -un)
[[ "$LOGNAME" == LOGIN ]] && LOGNAME=$(/usr/bin/id -un)
fi
# if [[ "$(uname)" == 'Linux' ]]; then
# export MALLOC_PERTURB_=$(( (RANDOM % 255) + 1 ))
# fi
__split_path_return=()
__split_path() {(
local IFS=':'
__split_path_return=($=1)
)}
local p5_dir="${HOME}/Perl5"
local need_path=( "${p5_dir}/bin" )
export PERL5LIB="${HOME}/.local/lib/perl5:${p5_dir}/lib/perl5${PERL5LIB:+:${PERL5LIB}}"
export PERL_LOCAL_LIB_ROOT="${p5_dir}${PERL_LOCAL_LIB_ROOT:+:${PERL_LOCAL_LIB_ROOT}}"
export PERL_MB_OPT="--install_base \"${p5_dir}\""
export PERL_MM_OPT="INSTALL_BASE=${p5_dir}"
case "$SYSID" in
slackware)
export path=( "${HOME}"/.local/bin /usr/local/sbin /usr/sbin /sbin /usr/local/bin /usr/bin /bin /usr/games /usr/lib64/kde4/libexec /usr/lib64/qt/bin /usr/share/texmf/bin )
;;
gentoo|laptop-gentoo)
local adtl_path=( )
[[ -d '/usr/mnt/bin' ]] && adtl_path+='/usr/mnt/bin'
[[ -d '/usr/share/perl6/site/bin' ]] && adtl_path+='/usr/share/perl6/site/bin'
#export path=( "${HOME}/.local/bin" /opt/bin $need_path $adtl_path /usr/lib/ccache/bin /usr/local/sbin /usr/local/bin /usr/x86_64-pc-linux-gnu/bin /opt/rust/cargo/bin /opt/clang-bin /opt/go/bin /usr/lib/go/bin /usr/sbin /usr/bin /sbin /bin )
export path=( "${HOME}/.local/bin" /opt/bin /opt/rust/cargo/bin $need_path $adtl_path /usr/local/sbin /usr/local/bin /usr/x86_64-pc-linux-gnu/bin /opt/rust/cargo/bin /opt/clang-bin /opt/go/bin /usr/lib/go/bin /usr/sbin /usr/bin /sbin /bin )
export PT=/var/tmp/portage
export RUSTUP_HOME=/opt/rust/rustup
export CARGO_HOME=/opt/rust/cargo
# export SCCACHE_DIR="/var/cache/sccache"
# export SCCACHE_CACHE_SIZE="25G"
;;
FreeBSD)
export path=( "${HOME}/.local/bin" /usr/local/libexec/ccache /opt/bin /usr/local/llvm12/bin /usr/local/sbin /usr/local/bin /usr/sbin /usr/bin /sbin /bin )
;;
GhostBSD)
export path=( "${HOME}/.local/bin" /opt/bin /opt/local/bin /usr/local/llvm12/bin /usr/local/sbin /usr/local/bin /usr/sbin /usr/bin /sbin /bin $path )
;;
DragonFly)
export path=( "${HOME}/.local/bin" /opt/bin /opt/clang-bin /usr/local/llvm-devel/bin /usr/local/sbin /usr/local/bin /usr/sbin /usr/bin /usr/games /sbin /bin )
;;
ArchLinux|Artix)
export path=( "${HOME}/.local/bin" $need_path /usr/lib/ccache/bin /opt/bin /usr/local/bin $path )
;;
msys2)
__mingw_fix_path() {
if [[ "$MINGW_PREFIX" ]]; then
export path=( "${MINGW_PREFIX}/bin" $path )
fi
export path=( "${HOME}/.local/bin" /opt/bin $path /c/Vim/Neovim/bin )
#if echo $path | grep -q 'ucrt64' &>/dev/null; then
# export path=( "${HOME}/.local/bin" /ucrt64/bin $path /c/Vim/Neovim/bin /d/libs/bin )
#else
# export path=( "${HOME}/.local/bin" /mingw64/bin $path /c/Vim/Neovim/bin /d/libs/bin )
#fi
export path=( "${HOME}/.local/bin" /mingw64/bin $path /c/Vim/Neovim/bin /d/libs/bin )
for ((i = 1; i <= $#path; ++i)); do
[[ $path[$i] == '/bin' ]] && path[$i]=()
done
echo $PATH
}
export PATH=$(__mingw_fix_path)
__split_path "$WINPATH"
export WINPATH="$ORIGINAL_PATH"
export winpath=($__split_path_return)
;;
WSL_Ubuntu)
export path=( "${HOME}/.local/bin" $need_path /opt/bin /opt/gcc12/bin /opt/cargo/bin /opt/clang-bin /opt/go/bin /usr/local/bin /usr/local/sbin /usr/bin /usr/sbin /bin /sbin $path )
export CARGO_HOME=/opt/cargo
export PERL5LIB="${PERL5LIB}:${HOME}/personaldotfiles/Scripts/perl/xtar/perl5"
export MAKESYSPATH=/opt/bmake/share/mk
;;
macOS)
export path=( /usr/local/opt/gcc/bin /usr/local/opt/binutils/bin /usr/local/opt/llvm/bin $path )
;;
esac
if [[ -o interactive ]] && [[ -z "$_PAGER_OPTS_SET" ]]; then
typeset -a lp; lp=( ${^path}/lesspipe(N) )
if [[ -x "${HOME}/.local/bin/lesspipe.sh" ]]; then
export LESSOPEN="||${HOME}/.local/bin/lesspipe.sh %s"
elif (( $#lp > 0 )) && [[ -x $lp[1] ]]; then
export LESSOPEN="||lesspipe %s"
elif [[ -x /usr/bin/lesspipe.sh ]]; then
export LESSOPEN="||lesspipe.sh %s"
fi
command -v highlight &>/dev/null && export LESSCOLORIZER="highlight -t8 --out-format=truecolor --force --style=myMolokai"
unset lp
export READNULLCMD=${PAGER:-/usr/bin/pager}
# MAKEDEV should be usable on udev as well by default:
export WRITE_ON_UDEV=yes
export _PAGER_OPTS_SET='yes'
fi
case "$SYSID" in
gentoo|laptop-gentoo|ArchLinux|Artix|WSL_Ubuntu)
export LESSOPEN="||/usr/local/sbin/lesspipe.sh %s"
alias less2="LESSOPEN='||/usr/bin/lesspipe %s' less"
;;
esac
#if [[ "$(uname)" == 'FreeBSD' ]]; then
# export path=( "${HOME}/.local/bin" /usr/local/libexec/ccache /opt/bin /opt/clang-bin /usr/local/sbin /usr/local/bin /usr/sbin /usr/bin /sbin /bin )
#elif [[ "$(uname)" == 'DragonFly' ]]; then
# export path=( /usr/local/llvm-devel/bin /usr/local/sbin /usr/local/bin /usr/pkg/sbin /usr/pkg/bin /usr/sbin /usr/bin /usr/games /sbin /bin "${HOME}/bin" )
#elif [[ "$(uname -r)" =~ 'ARCH' ]]; then
# export path=( "${HOME}/.local/bin" "/usr/local/bin" $path "${HOME}/.gem/ruby/2.4.0/bin" )
#fi
export GOPATH=/opt/go
export path=( $path /opt/go/bin )
unset __split_path_return
setopt no_global_rcs
# vim:filetype=zsh foldmethod=marker autoindent expandtab shiftwidth=4