-
Notifications
You must be signed in to change notification settings - Fork 1
/
dot_zprofile.tmpl
113 lines (97 loc) · 2.74 KB
/
dot_zprofile.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
# Execute code that does not affect the current session in the background.
{
# Compile the completion dump to increase startup speed.
zcompdump="${ZDOTDIR:-$HOME}/.zcompdump"
if [[ -s "$zcompdump" && (! -s "${zcompdump}.zwc" || "$zcompdump" -nt "${zcompdump}.zwc") ]]; then
zcompile "$zcompdump"
fi
} &!
#
# Editors
#
export EDITOR='vim'
export VISUAL='vim'
export PAGER='less'
#
# Language
#
if [[ -z "$LANG" ]]; then
export LANG='en_US.UTF-8'
fi
#
# Paths
#
# Ensure path arrays do not contain duplicates.
typeset -gU cdpath fpath mailpath path
# Set the list of directories that cd searches.
# cdpath=(
# $cdpath
# )
# Set the default Less options.
{{- if .less_mouse }}
export LESS='-F -g -i -M -R -S -w -X -z-4 --mouse --wheel-lines 4'
{{- else }}
export LESS='-F -g -i -M -R -S -w -X -z-4'
{{- end }}
# Set the Less input preprocessor.
# Try both `lesspipe` and `lesspipe.sh` as either might exist on a system.
if (( $#commands[(i)lesspipe(|.sh)] )); then
export LESSOPEN="| /usr/bin/env $commands[(i)lesspipe(|.sh)] %s 2>&-"
fi
{{- if stat "/usr/local/bin/brew" }}
eval $(/usr/local/bin/brew shellenv)
{{- else if stat "/opt/homebrew/bin/brew" }}
eval $(/opt/homebrew/bin/brew shellenv)
{{- end }}
export PYENV_ROOT={{ if stat "/opt/pyenv/bin" }}"/opt/pyenv"{{ else }}"$HOME/.pyenv"{{ end }}
_search_path=(
"$HOME/.local/share/JetBrains/Toolbox/scripts"
"${KREW_ROOT:-$HOME/.krew}/bin"
"$HOME/.local/bin"
"$HOME/.cargo/bin"
"$HOME/go/bin"
"$PYENV_ROOT/bin"
"/opt/homebrew/bin"
"$(python3 -m site --user-base)/bin"
/usr/local/{bin,sbin}
{/,/usr/}{bin,sbin}
$path
)
# Reset PATH
path=()
for d in $_search_path; do
[[ ! -d $d ]] && continue
# Resolve absolute path
d=$(cd "$d"; pwd -P)
if (( ! ${path[(I)$d]} )); then
path=($path $d)
fi
done
unset _search_path
if command -v pyenv &>/dev/null; then
[[ $(pyenv --version) =~ "pyenv 2." ]] && eval "$(pyenv init --path)"
export PYENV_VIRTUALENV_DISABLE_PROMPT=1
else
unset PYENV_ROOT
fi
{{- if .is.wsl }}
if [[ -n ${WSL_AGENT_HOME} ]]; then
export GNUPGHOME=${WSL_AGENT_HOME}
export SSH_AUTH_SOCK=${WSL_AGENT_HOME}/S.gpg-agent.ssh
fi
export GDK_SCALE=2
export QT_SCREEN_SCALE_FACTORS=2
export QT_AUTO_SCREEN_SCALE_FACTOR=0
export DISPLAY=localhost:0.0
{{- else if .is.mac }}
# Fix Ansible crash
export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES
{{- else if not .is.root }}
{{- if and (lookPath "vagrant") (lookPath "libvirtd") }}
export VAGRANT_DEFAULT_PROVIDER=libvirt
{{- end }}
{{- if or (lookPath "startx") (lookPath "sway") }}
[[ -z "$DISPLAY" && $(systemctl get-default) = "graphical.target" && "$(tty)" = /dev/tty1 ]] && exec ~/.local/bin/start-gui &> ~/.cache/start-gui.log
{{- end }}
{{ template "ssh_auth_sock" }}
{{- end }}