-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path.zshrc
More file actions
93 lines (76 loc) · 2.94 KB
/
.zshrc
File metadata and controls
93 lines (76 loc) · 2.94 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
#!/usr/bin/env zsh
# Zush - High-Performance ZSH Configuration
# Main orchestrator that loads libraries and sources rc.d scripts
# Early exit if Zush is disabled
[[ -n "${ZUSH_DISABLE}" ]] && return
# Capture start time for timing debug logs
# Start timing for startup measurement
typeset -g ZUSH_START_TIME=$(date +%s%3N)
# Configuration - ZDOTDIR should be set to ~/.config/zush
typeset -g ZUSH_HOME="$ZDOTDIR"
typeset -g ZUSH_LIB_DIR="${ZUSH_HOME}/lib"
typeset -g ZUSH_RC_DIR="${ZUSH_HOME}/rc.d"
typeset -g ZUSH_CACHE_DIR="${HOME}/.cache/zush"
typeset -g ZUSH_DEBUG="${ZUSH_DEBUG:-0}"
# Create cache directory if needed
[[ ! -d "${ZUSH_CACHE_DIR}" ]] && mkdir -p "${ZUSH_CACHE_DIR}"
# Enable profiling as early as possible
if [[ "${ZUSH_PROFILE:-0}" == "1" ]]; then
zmodload zsh/zprof
fi
# Show instant prompt as early as possible (before any heavy loading)
if [[ -f "${ZUSH_LIB_DIR}/instant-prompt.zsh" ]]; then
# Load core functions first for zush_debug (but preserve ZUSH_START_TIME)
[[ -f "${ZUSH_LIB_DIR}/core.zsh" ]] && source "${ZUSH_LIB_DIR}/core.zsh"
source "${ZUSH_LIB_DIR}/instant-prompt.zsh"
_zush_show_instant_prompt
fi
# Load utility libraries first
# These provide functions used by rc.d scripts
if [[ -d "${ZUSH_LIB_DIR}" ]]; then
# Load in specific order if they exist
for lib in core compiler lazy-loader utils; do
local lib_file="${ZUSH_LIB_DIR}/${lib}.zsh"
[[ -f "$lib_file" ]] && source "$lib_file"
done
# Load profiler only if profiling is enabled
if [[ "${ZUSH_PROFILE:-0}" == "1" ]]; then
local profiler_file="${ZUSH_LIB_DIR}/profiler.zsh"
[[ -f "$profiler_file" ]] && source "$profiler_file"
fi
# Load any other libraries not in the priority list
for lib_file in "${ZUSH_LIB_DIR}"/*.zsh(N); do
local basename="${lib_file:t:r}"
case "$basename" in
core|profiler|compiler|lazy-loader|utils) continue ;;
*) _zush_source "$lib_file" ;;
esac
done
fi
# Source all rc.d scripts in numerical order
if [[ -d "${ZUSH_RC_DIR}" ]]; then
for script in "${ZUSH_RC_DIR}"/*.zsh(N); do
_zush_source "$script"
done
fi
# Load machine-specific Zush configuration
[[ -f "${HOME}/.zushrc" ]] && _zush_source "${HOME}/.zushrc"
# Auto-compile all configuration files in the background
if (( ${+functions[_zushc_bg]} )); then
_zushc_bg
fi
# Hand off instant prompt to real starship
if (( ${+functions[_zush_wait_before_handoff_if_needed]} )); then
_zush_wait_before_handoff_if_needed
elif (( ${+functions[_zush_handoff_to_real_prompt]} )); then
_zush_handoff_to_real_prompt
fi
# Check for available updates and prompt, or start background check if needed
if (( ${+functions[_zush_start_update_check]} )); then
_zush_start_update_check
fi
if (( ${+functions[_zush_prompt_available_update]} )); then
_zush_prompt_available_update
fi
# Clean up (core functions stay available)
# unset -f # nothing to clean up currently