|
|
@@ -1,7 +1,6 @@
|
|
|
PLUGIN_DIR="$HOME/.local/share/zsh/plugins"
|
|
|
mkdir -p "$PLUGIN_DIR"
|
|
|
|
|
|
-# Install plugins (only if missing)
|
|
|
plugins=(
|
|
|
"blimmer/zsh-aws-vault"
|
|
|
"romkatv/zsh-defer"
|
|
|
@@ -15,11 +14,9 @@ plugins=(
|
|
|
"zsh-users/zsh-syntax-highlighting"
|
|
|
)
|
|
|
|
|
|
-# Plugin management function
|
|
|
zap() {
|
|
|
echo "⚡ Updating plugins..."
|
|
|
|
|
|
- # Update plugins sequentially (clean output)
|
|
|
for plugin in "${plugins[@]}"; do
|
|
|
plugin_name=${plugin##*/}
|
|
|
|
|
|
@@ -57,41 +54,70 @@ zap() {
|
|
|
|
|
|
for plugin in "${plugins[@]}"; do
|
|
|
plugin_name=${plugin##*/}
|
|
|
- [ -d "$PLUGIN_DIR/$plugin_name" ] || git clone --quiet "https://github.com/$plugin" "$PLUGIN_DIR/$plugin_name" --depth=1
|
|
|
+ [[ -d "$PLUGIN_DIR/$plugin_name" ]] || git clone --quiet "https://github.com/$plugin" "$PLUGIN_DIR/$plugin_name" --depth=1
|
|
|
done
|
|
|
|
|
|
-# Source plugins
|
|
|
source "$PLUGIN_DIR/zsh-defer/zsh-defer.plugin.zsh"
|
|
|
-
|
|
|
-# Defer heavy plugins for faster startup
|
|
|
source "$PLUGIN_DIR/zsh-aws-vault/zsh-aws-vault.plugin.zsh"
|
|
|
+
|
|
|
+_batch_defer() {
|
|
|
+ local files=("$@")
|
|
|
+ for file in "${files[@]}"; do
|
|
|
+ [[ -f "$file" ]] && source "$file"
|
|
|
+ done
|
|
|
+}
|
|
|
+
|
|
|
zsh-defer source "$PLUGIN_DIR/zsh-autosuggestions/zsh-autosuggestions.zsh"
|
|
|
zsh-defer source "$PLUGIN_DIR/zsh-autopair/autopair.zsh"
|
|
|
zsh-defer source "$PLUGIN_DIR/zsh-history-substring-search/zsh-history-substring-search.zsh"
|
|
|
-zsh-defer source "$PLUGIN_DIR/fzf-tab/fzf-tab.plugin.zsh"
|
|
|
-zsh-defer source "$PLUGIN_DIR/fzf/shell/completion.zsh"
|
|
|
-zsh-defer source "$PLUGIN_DIR/fzf/shell/key-bindings.zsh"
|
|
|
-zsh-defer source "$PLUGIN_DIR/vim/vim.plugin.zsh"
|
|
|
|
|
|
source "$PLUGIN_DIR/minimal/minimal.zsh"
|
|
|
|
|
|
-# Source config files
|
|
|
source "$ZDOTDIR/opts.zsh"
|
|
|
source "$ZDOTDIR/rose-pine.sh"
|
|
|
-#source "$ZDOTDIR/maintenance.zsh"
|
|
|
-
|
|
|
-# Defer loading
|
|
|
-zsh-defer source "$PLUGIN_DIR/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh"
|
|
|
|
|
|
-# Load function files
|
|
|
-for func_file in "$ZDOTDIR/functions"/*.zsh; do
|
|
|
- zsh-defer source "$func_file"
|
|
|
-done
|
|
|
-
|
|
|
-# Load external completions
|
|
|
-zsh-defer source "$ZDOTDIR/completions/external.zsh"
|
|
|
+source "$ZDOTDIR/tmux.zsh"
|
|
|
+
|
|
|
+zsh-defer _batch_defer "$ZDOTDIR/alias.zsh" "$ZDOTDIR/keymap.zsh" "$ZDOTDIR/path.zsh" "$ZDOTDIR/pnpm.zsh" "$ZDOTDIR/mise.zsh"
|
|
|
+
|
|
|
+local func_files=("$ZDOTDIR/functions"/*.zsh)
|
|
|
+zsh-defer _batch_defer "${func_files[@]}" "$ZDOTDIR/completions/external.zsh"
|
|
|
+
|
|
|
+zsh-defer _batch_defer \
|
|
|
+ "$PLUGIN_DIR/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" \
|
|
|
+ "$PLUGIN_DIR/fzf-tab/fzf-tab.plugin.zsh" \
|
|
|
+ "$PLUGIN_DIR/fzf/shell/completion.zsh" \
|
|
|
+ "$PLUGIN_DIR/fzf/shell/key-bindings.zsh" \
|
|
|
+ "$PLUGIN_DIR/vim/vim.plugin.zsh"
|
|
|
+
|
|
|
+_compile_zsh_files() {
|
|
|
+ (
|
|
|
+ local files=(
|
|
|
+ "$ZDOTDIR/init.zsh"
|
|
|
+ "$ZDOTDIR/opts.zsh"
|
|
|
+ "$ZDOTDIR/rose-pine.sh"
|
|
|
+ "$ZDOTDIR/completions/external.zsh"
|
|
|
+ "$ZDOTDIR/tmux.zsh"
|
|
|
+ "$ZDOTDIR/alias.zsh"
|
|
|
+ "$ZDOTDIR/keymap.zsh"
|
|
|
+ "$ZDOTDIR/path.zsh"
|
|
|
+ "$ZDOTDIR/pnpm.zsh"
|
|
|
+ "$ZDOTDIR/mise.zsh"
|
|
|
+ )
|
|
|
+
|
|
|
+ for func_file in "$ZDOTDIR/functions"/*.zsh; do
|
|
|
+ files+=("$func_file")
|
|
|
+ done
|
|
|
+
|
|
|
+ for file in "${files[@]}"; do
|
|
|
+ [[ ! -f "$file" ]] && continue
|
|
|
+ local zwc="${file}.zwc"
|
|
|
+ if [[ "$file" -nt "$zwc" ]] || [[ ! -f "$zwc" ]]; then
|
|
|
+ zcompile "$file" 2>/dev/null &
|
|
|
+ fi
|
|
|
+ done
|
|
|
+ wait
|
|
|
+ ) > /dev/null 2>&1 &!
|
|
|
+}
|
|
|
|
|
|
-# Load other config files
|
|
|
-for config in tmux.zsh alias.zsh keymap.zsh path.zsh pnpm.zsh mise.zsh; do
|
|
|
- zsh-defer source "$ZDOTDIR/$config"
|
|
|
-done
|
|
|
+zsh-defer _compile_zsh_files
|