/
dot_zshrc.tmpl
163 lines (127 loc) · 4.29 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
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
# vim: filetype=zsh
# Per-function profiling:
# zmodload zsh/zprof
export XDG_CONFIG_HOME=$HOME/.config
export XDG_CACHE_HOME=$HOME/.cache
export XDG_DATA_HOME=$HOME/.local/share
export XDG_STATE_HOME=$HOME/.local/state
export ZSH_HOME=~/.config/zsh
export ZSH_CACHE_DIR=~/.cache/zsh
export SHELL=$HOME/.nix-profile/bin/zsh
export VISUAL=nvim
export EDITOR=nvim
export MANPAGER="sh -c 'col -bx | bat -l man -p'"
export MANROFFOPT="-c"
function prepend_path {
for p in $@; do
if (test -d $p); then
export PATH="$p:$PATH"
fi
done
}
# executable search path (last to first order)
prepend_path "/usr/local/bin" "/usr/local/sbin"
# Setup DEFAULT_USER for the theme
USER=`whoami`
if [ $USER = '{{ .chezmoi.username }}' ]; then
DEFAULT_USER=$USER
fi
SRC_FILES=(
$HOME/.nix-profile/etc/profile.d/nix.sh
$HOME/.nix-profile/etc/profile.d/hm-session-vars.sh
)
for p in $SRC_FILES; do
if (test -e $p); then
source $p
fi
done
# ZSH completions
for profile in ''${(z)NIX_PROFILES}; do
fpath+=($profile/share/zsh/site-functions $profile/share/zsh/$ZSH_VERSION/functions $profile/share/zsh/vendor-completions)
done
#{{- if ne "macOS" .ostype }}
# Fix nix locale errors
export LOCALE_ARCHIVE=/usr/lib/locale/locale-archive
export LANGUAGE=en_GB.UTF-8
export LANG=en_GB.UTF-8
export LC_ALL=en_GB.UTF-8
#{{- end }}
# Disables scroll lock shortcut (Ctrl+s)
stty -ixon
KEYTIMEOUT=1
# fzf defaults
export FZF_TMUX_OPTS="-d 40%"
export FZF_CTRL_T_OPTS="\
--preview 'bat --style=numbers --color=always {} | head -500'
--bind='?:toggle-preview'
"
export FZF_DEFAULT_OPTS="\
--layout reverse \
--color=bg+:#414559,bg:#303446,spinner:#f2d5cf,hl:#e78284 \
--color=fg:#c6d0f5,header:#e78284,info:#ca9ee6,pointer:#f2d5cf \
--color=marker:#f2d5cf,fg+:#c6d0f5,prompt:#ca9ee6,hl+:#e78284 \
--bind ctrl-u:preview-half-page-up,ctrl-d:preview-half-page-down
"
# Prevent FFP opening multiple splits
export FPP_DISABLE_SPLIT=1
# tmuxp thing
export DISABLE_AUTO_TITLE='true'
zstyle :omz:plugins:ssh-agent agent-forwarding on
zstyle :omz:plugins:ssh-agent lazy true
zstyle :omz:plugins:ssh-agent lifetime 12h
export ZSH_TMUX_AUTOQUIT="false"
export ZSH_TMUX_AUTOCONNECT="false"
# Disable default aliases like glo
export FORGIT_NO_ALIASES=true
# Setup ls colors
eval `dircolors $HOME/.dir_colors`
source ~/.nix-profile/share/antigen/antigen.zsh
# patches required for modules
antigen bundle $ZSH_HOME/patches
antigen bundle zsh-users/zsh-autosuggestions
antigen bundle zsh-users/zsh-completions
antigen bundle zsh-users/zsh-syntax-highlighting
antigen bundle robbyrussell/oh-my-zsh lib/completion.zsh
antigen bundle robbyrussell/oh-my-zsh lib/key-bindings.zsh
antigen bundle robbyrussell/oh-my-zsh lib/theme-and-appearance.zsh
antigen bundle robbyrussell/oh-my-zsh plugins/asdf
antigen bundle robbyrussell/oh-my-zsh plugins/common-aliases
antigen bundle robbyrussell/oh-my-zsh plugins/docker
antigen bundle robbyrussell/oh-my-zsh plugins/fzf
antigen bundle robbyrussell/oh-my-zsh plugins/kubectl
antigen bundle robbyrussell/oh-my-zsh plugins/ssh-agent
antigen bundle robbyrussell/oh-my-zsh plugins/terraform
antigen bundle robbyrussell/oh-my-zsh plugins/tmux
antigen bundle robbyrussell/oh-my-zsh plugins/z
antigen bundle wfxr/forgit
antigen theme romkatv/powerlevel10k
# personal settings, override modules
antigen bundle $ZSH_CACHE_DIR/completions
antigen bundle $ZSH_HOME/lib
antigen bundle $ZSH_HOME/functions
antigen apply
sourceOPSession
# Re-export PATH again after nix with ~/.local/bin at the front to allow overrides
prepend_path "$HOME/.local/bin" "$HOME/.gem/ruby/2.7.0/bin"
# forgit config
# configure checkout_branch to sort by most recent commit
export FORGIT_CHECKOUT_BRANCH_BRANCH_GIT_OPTS='--sort=-committerdate'
# append `git-forgit` to path
export PATH="$PATH:$FORGIT_INSTALL_DIR/bin"
# PNPM global install path
export PNPM_HOME="$HOME/.local/share/pnpm"
case ":$PATH:" in
*":$PNPM_HOME:"*) ;;
*) export PATH="$PNPM_HOME:$PATH" ;;
esac
# Need to run this after oh-my-zsh lib/completion as it resets it
# for the benefit of macOS
zstyle ':completion:*' list-colors "${(@s.:.)LS_COLORS}"
LOCAL_RC=~/.zshrc.local
if [ -e $LOCAL_RC ]; then
source $LOCAL_RC
fi
# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
# Per-function profiling:
# zprof > /tmp/zsh-prof-$$.txt