From 588a2006aae3a5f41c666420f7f820d60c5f5c51 Mon Sep 17 00:00:00 2001 From: Danielle McLean Date: Sun, 19 Nov 2023 14:25:27 +1100 Subject: [PATCH] Turbo-mode completions and other interactive niceties :) --- dot-config/zsh/zinit | 16 ++++++++-------- dot-config/zsh/zshrc | 14 +++++++++++--- 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/dot-config/zsh/zinit b/dot-config/zsh/zinit index 075f3a5..7facb46 100644 --- a/dot-config/zsh/zinit +++ b/dot-config/zsh/zinit @@ -28,11 +28,11 @@ else zinit pack:no-dir-color-swap for ls_colors fi -zinit ice silent wait:1 atload:_zsh_autosuggest_start -zinit $load zsh-users/zsh-autosuggestions - -zinit ice blockf; zinit $load zsh-users/zsh-completions - -zinit ice silent wait:1; zinit $load mollifier/cd-gitroot - -zinit ice silent wait!1; zinit $load zdharma-continuum/fast-syntax-highlighting +zinit wait lucid light-mode for \ + mollifier/cd-gitroot \ + atinit"dot-zsh-compinit" \ + zdharma-continuum/fast-syntax-highlighting \ + atload"_zsh_autosuggest_start" \ + zsh-users/zsh-autosuggestions \ + blockf atpull'zinit creinstall -q .' \ + zsh-users/zsh-completions diff --git a/dot-config/zsh/zshrc b/dot-config/zsh/zshrc index 946837e..0ee8df8 100644 --- a/dot-config/zsh/zshrc +++ b/dot-config/zsh/zshrc @@ -1,9 +1,17 @@ +# Optimised compinit taking advantage of zinit's completion handling, as well +# as compiling the resulting zcompdump file. Have zinit call this once +# everything is loaded using an atload ice. +dot-zsh-compinit() { + [[ -d $ZINIT[ZCOMPDUMP_PATH] ]] || mkdir -p ${ZINIT[ZCOMPDUMP_PATH]:h} + zicompinit || return $? + zicdreplay || return $? + ([[ $ZINIT[ZCOMPDUMP_PATH].zwc -nt $ZINIT[ZCOMPDUMP_PATH] ]] || zcompile $ZINIT[ZCOMPDUMP_PATH]) &! + return 0 +} + source $ZDOTDIR/zinit for f in $ZDOTDIR/interactive/^*.zwc(N); source $f -zpcompinit && zpcdreplay -([[ $ZINIT[ZCOMPDUMP_PATH].zwc -nt $ZINIT[ZCOMPDUMP_PATH] ]] || zcompile $ZINIT[ZCOMPDUMP_PATH]) &! - [[ -o login ]] && for f in $ZDOTDIR/interactive+login/^*.zwc(N); source $f # If zsh init ends with a failing command (like a conditional) the prompt will