diff --git a/.gitignore b/.gitignore index 6139980..93938a2 100644 --- a/.gitignore +++ b/.gitignore @@ -20,3 +20,4 @@ vim/.netrwhist # Ignore anything that is transient */transient/* +*/cache/* diff --git a/zsh/transient/.keep b/zsh/cache/.keep similarity index 100% rename from zsh/transient/.keep rename to zsh/cache/.keep diff --git a/zsh/makefile b/zsh/makefile index 62b4bdb..c7e61b4 100644 --- a/zsh/makefile +++ b/zsh/makefile @@ -16,8 +16,8 @@ init: $(mk_link) $(ZSH_DIR)/zprofile ~/.zprofile $(mk_link) $(ZSH_DIR)/zshenv ~/.zshenv $(mk_link) $(ZSH_DIR)/zlogout ~/.zlogout - chmod 700 $(ZSH_DIR)/transient \ - ; $(report) "updating transient permissions" + chmod 700 $(ZSH_DIR)/cache \ + ; $(report) "updating cache permissions" init_zplug: if [ ! -e $(ZPLUG_DIR) ] ; then diff --git a/zsh/modules/complete/init.zsh b/zsh/modules/complete/init.zsh index f2aa7f5..330aeae 100644 --- a/zsh/modules/complete/init.zsh +++ b/zsh/modules/complete/init.zsh @@ -14,6 +14,19 @@ unsetopt COMPLETE_ALIASES # Completion for aliases unsetopt ALWAYS_TO_END # Move cursor to the end of a completed word. unsetopt CASE_GLOB +autoload -Uz compinit +_comp_path="${ZSH_CACHE}/zcompdump" +# #q expands globs in conditional expressions +if [[ $_comp_path(#qNmh-20) ]]; then + # -C (skip function check) implies -i (skip security check). + compinit -C -d "$_comp_path" +else + mkdir -p "$_comp_path:h" + compinit -i -d "$_comp_path" +fi +unset _comp_path + + # Use caching to make completion for commands such as dpkg and apt usable. zstyle ':completion::complete:*' use-cache on zstyle ':completion::complete:*' cache-path "$ZSH_CACHE/zcompcache" diff --git a/zsh/modules/history/init.zsh b/zsh/modules/history/init.zsh index 22fece3..ce202c5 100644 --- a/zsh/modules/history/init.zsh +++ b/zsh/modules/history/init.zsh @@ -1,6 +1,6 @@ -HISTFILE=${HISTFILE:-$ZDIR/transient/history} # The path to the history file. -HISTSIZE=100000 # The maximum number of events to save in the internal history. -SAVEHIST=100000 # The maximum number of events to save in the history file. +HISTFILE="${ZSH_CACHE}/history" # The path to the history file. +HISTSIZE=100000 # The maximum number of events to save in the internal history. +SAVEHIST=100000 # The maximum number of events to save in the history file. setopt BANG_HIST # Treat the '!' character specially during expansion. setopt EXTENDED_HISTORY # Write the history file in the ':start:elapsed;command' format. diff --git a/zsh/zlogin b/zsh/zlogin index 955f4ee..6fe9dc5 100644 --- a/zsh/zlogin +++ b/zsh/zlogin @@ -8,7 +8,7 @@ { # Compile the completion dump to increase startup speed. # - zcompdump="${ZDIR}/transient/.zcompdump" + zcompdump="${ZSH_CACHE}/zcompdump" if [[ -s "$zcompdump" && (! -s "${zcompdump}.zwc" || "$zcompdump" -nt "${zcompdump}.zwc") ]]; then zcompile "$zcompdump" fi diff --git a/zsh/zplug b/zsh/zplug index 97523a2..7f234f3 100755 --- a/zsh/zplug +++ b/zsh/zplug @@ -8,7 +8,7 @@ zplug "zdharma/zsh-diff-so-fancy", as:command, use:"bin/{git-dsf,diff-so-fancy}" zplug "bigH/git-fuzzy", as:command, use:"bin/git-fuzzy" zplug "${ZDIR}/modules/alias/", from:local, as:plugin -zplug "${ZDIR}/modules/complete/", from:local, as:plugin +zplug "${ZDIR}/modules/complete/", from:local, as:plugin, defer:2 zplug "${ZDIR}/modules/directory/", from:local, as:plugin zplug "${ZDIR}/modules/history/", from:local, as:plugin zplug "${ZDIR}/modules/keybinds/", from:local, as:plugin @@ -17,7 +17,7 @@ zplug "junegunn/fzf", use:"shell/*.zsh", defer:2 zplug "mafredri/zsh-async", as:plugin, defer:2 zplug "zdharma/fast-syntax-highlighting", as:plugin, defer:2 zplug "zsh-users/zsh-autosuggestions", as:plugin, defer:2 -zplug "zsh-users/zsh-completions", as:plugin, defer:2 +zplug "zsh-users/zsh-completions", as:plugin zplug "zsh-users/zsh-history-substring-search", as:plugin, defer:2 if (($+commands[yarn])) ; then diff --git a/zsh/zshenv b/zsh/zshenv index c163d30..a2daedc 100644 --- a/zsh/zshenv +++ b/zsh/zshenv @@ -8,6 +8,7 @@ export LANG=en_US.UTF-8 export ZDOTDIR=${ZDOTDIR:-$HOME} export ZDIR=${ZDIR:-$HOME/.zsh} export ZPLUG_HOME=${ZPLUG_HOME:-$HOME/.zplug} +export ZSH_CACHE=${ZSH_CACHE:-$ZDIR/cache} export EDITOR='vim' export VISUAL='vim'