-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathzshrc
More file actions
executable file
·121 lines (105 loc) · 3.02 KB
/
zshrc
File metadata and controls
executable file
·121 lines (105 loc) · 3.02 KB
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
# path
typeset -U path
path=(
"$HOME/.bin"
"$HOME/.local/bin"
"$HOME/tizen-studio/tools/ide/bin"
"$HOME/tizen-studio/tools"
$path
)
export PATH
# zsh base dir
export ZSH_BASE=$HOME/.zsh
# Optional startup profiling: run `ZSH_PROFILE=1 zsh -i -c exit`
if [[ "${ZSH_PROFILE:-0}" == "1" ]]; then
zmodload zsh/zprof
fi
# brew completions
if [[ -n "${HOMEBREW_PREFIX:-}" ]]; then
FPATH="${HOMEBREW_PREFIX}/share/zsh/site-functions:${FPATH}"
fi
export HOMEBREW_NO_ENV_HINTS=TRUE
export HOMEBREW_DOWNLOAD_CONCURRENCY=auto
# antidote
# Clone antidote if necessary.
[[ -e ${ZDOTDIR:-~}/.antidote ]] ||
command git clone https://github.com/mattmc3/antidote.git ${ZDOTDIR:-~}/.antidote
# Source antidote.
source ${ZDOTDIR:-~}/.antidote/antidote.zsh
# Build and source a static plugin bundle for faster startup.
_zsh_plugins_file=${ZDOTDIR:-$HOME}/.zsh_plugins.txt
_zsh_plugins_bundle=${ZDOTDIR:-$HOME}/.zsh_plugins.zsh
if [[ -f "$_zsh_plugins_file" ]]; then
if [[ ! -f "$_zsh_plugins_bundle" || "$_zsh_plugins_bundle" -ot "$_zsh_plugins_file" ]]; then
antidote bundle <"$_zsh_plugins_file" >|"$_zsh_plugins_bundle"
fi
source "$_zsh_plugins_bundle"
else
antidote load
fi
unset _zsh_plugins_file _zsh_plugins_bundle
# Load the theme.
#source $ZSH_BASE/jens.zsh-theme
# Defer Starship init until after first prompt (lazy load via precmd hook)
_init_starship() {
if command -v starship >/dev/null 2>&1; then
eval "$(starship init zsh)"
fi
[ -f ~/.starship.zsh ] && source ~/.starship.zsh
# Remove hook after first run
precmd_functions=("${(@)precmd_functions:#_init_starship}")
}
precmd_functions+=(_init_starship)
# Source additional config
source "$ZSH_BASE/aliases.zsh"
source "$ZSH_BASE/functions.zsh"
# GPG config
if command -v gpgconf >/dev/null 2>&1; then
export GPG_TTY="$(tty)"
export SSH_AUTH_SOCK="$(gpgconf --list-dirs agent-ssh-socket)"
gpgconf --launch gpg-agent >/dev/null 2>&1
fi
# fuzzy search
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
# set config dir for i.e. lazygit
export XDG_CONFIG_HOME="$HOME/.config"
if command -v vim >/dev/null 2>&1; then
export EDITOR="vim"
export VISUAL="vim"
export MANPAGER="vim -c ASMANPAGER -"
else
export EDITOR="vi"
export VISUAL="vi"
fi
# history optimize
export HISTSIZE=1000000
export SAVEHIST=$HISTSIZE
setopt INC_APPEND_HISTORY
setopt HIST_IGNORE_ALL_DUPS
setopt HIST_SAVE_NO_DUPS
setopt HIST_FIND_NO_DUPS
# completions: use cache to speed up cold starts
autoload -Uz compinit
if [[ -f ~/.zcompdump ]]; then
compinit -C
else
compinit
fi
# pipx completion (lazy: only load on first pipx invocation)
if command -v register-python-argcomplete >/dev/null 2>&1; then
_pipx_completion() {
eval "$(register-python-argcomplete pipx 2>/dev/null)" || true
unfunction _pipx_completion
}
# Hook into pipx command: initialize completion on first use
pipx() {
_pipx_completion
command pipx "$@"
}
fi
# QMK
export QMK_CONFIG="$HOME/.config/qmk/qmk.ini"
[ -f "$HOME/.local/bin/env" ] && . "$HOME/.local/bin/env"
if [[ "${ZSH_PROFILE:-0}" == "1" ]]; then
zprof
fi