-
Notifications
You must be signed in to change notification settings - Fork 0
/
dot_zshrc.tmpl
112 lines (92 loc) · 3.13 KB
/
dot_zshrc.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
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
export ZSH_CACHE_DIR="$HOME/.config/zsh/cache"
export HISTORY_IGNORE='(ls|(?:cd )?\.{2,}|docker (ps|rm|stop)|.*base64 -d$)'
{{ if (eq .osid "linux-arch") -}}
# pacdiff
DIFFPROG='nvim -d'
MERGEPROG='git merge-file -p --diff3'
{{- end }}
{{ if (hasKey .chezmoi.osRelease "id") -}}
export MANPAGER="sh -c 'col -bx | bat{{ if (eq .chezmoi.osRelease.id "ubuntu") }}cat{{ end }} -l man -p'"
{{- end }}
{{ if (eq .chezmoi.os "darwin") -}}
export MANPAGER="sh -c 'col -bx | bat -l man -p'"
{{- end }}
{{ if (eq .chezmoi.os "darwin") -}}
export HOMEBREW_NO_ANALYTICS=1
export HOMEBREW_PREFIX=/opt/homebrew
{{- end }}
# Variables may be already defined from the outside (e.g. VSCode terminal)
[ -z "$EDITOR" ] && export EDITOR='vim'
[ -z "$GIT_EDITOR" ] && export GIT_EDITOR='vim'
# zsh function paths
fpath=(
"$HOME/.config/zsh/zfunctions"
{{ if (eq .chezmoi.os "darwin") -}}"$HOMEBREW_PREFIX/share/zsh/site-functions"{{- end }}
"${fpath[@]}"
)
# Enable autocompletion
autoload -Uz compinit
() {
if [[ $# -gt 0 ]]; then
compinit
else
compinit -C
fi
} ${ZDOTDIR:-$HOME}/.zcompdump(N.mh+24)
# Enable ls colors
autoload -U colors; colors
export CLICOLOR=1
export LSCOLORS="Gxfxcxdxbxegedabagacad"
# Automatically quote meta-characters in URLs!
autoload -U url-quote-magic
zle -N self-insert url-quote-magic
# Enable zmv for moving/renaming files
# https://filipe.kiss.ink/zmv-zsh-rename/
autoload -Uz zmv
alias mmv='noglob zmv -W'
# Include dotfiles in globbing
# https://coderwall.com/p/rfwjlq
setopt globdots
# Don't share history between sessions/panes
# setopt no_share_history
# == Changing Directories ==
# If a command can’t be executed as a normal command, and the command is
# the name of a directory, perform the cd command to that directory.
setopt auto_cd
# don't push multiple copies of the same directory onto the directory stack
setopt pushd_ignore_dups
{{ if (eq .chezmoi.os "darwin") -}}
# == macOS ==
export HOMEBREW_NO_ANALYTICS=1
export HOMEBREW_NO_ENV_HINTS=1
export HOMEBREW_PREFIX=/opt/homebrew
if [ "${commands[go]}" ]; then
export GOBIN=$HOME/go/bin
export PATH=$HOMEBREW_PREFIX/opt/go/libexec/bin:$GOBIN:$PATH
fi
# Source GNU utils and manpages
for d in ${HOMEBREW_PREFIX}/opt/*/libexec/gnubin; do export PATH=$d:$PATH; done
for d in ${HOMEBREW_PREFIX}/opt/*/libexec/gnuman; do export MANPATH=$d:$MANPATH; done
export PATH=~/.local/bin:$HOMEBREW_PREFIX/sbin:$HOMEBREW_PREFIX/bin:$HOMEBREW_PREFIX/opt/openssl/bin:$PATH
export PATH="${KREW_ROOT:-$HOME/.krew}/bin:$PATH"
/bin/launchctl setenv PATH "$PATH"
{{- else if (eq .osid "linux-synology") -}}
export PATH=~/.local/bin:/opt/sbin:/opt/bin:$PATH
{{- else -}}
export PATH=~/.local/bin:$PATH
{{ end }}
# == Sourcing all the things ... ==
for file in ~/.config/zsh/*.zsh; do source "$file"; done; unset file
source ~/.config/zsh/zfunctions/syntax-highlighting
[ -f ~/.extra ] && source ~/.extra
{{- if (eq .osid "linux-arch") }}
source /usr/share/fzf/key-bindings.zsh
source /usr/share/fzf/completion.zsh
{{ else }}
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
{{ end }}
# == Prompt ==
autoload -U promptinit; promptinit
eval "$(starship init zsh)"