Fixed issue with autocompletes not being loaded

The issue was stemming from racecondition betwwen then completion
function which uses the complete file, and the zsh_users/completions
plug that defined them.

Also relocated transient -> cache.
This commit is contained in:
James Patrick 2020-08-21 18:01:04 -04:00
parent fe83484ffc
commit 829f30540e
8 changed files with 23 additions and 8 deletions

1
.gitignore vendored
View File

@ -20,3 +20,4 @@ vim/.netrwhist
# Ignore anything that is transient
*/transient/*
*/cache/*

View File

@ -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

View File

@ -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"

View File

@ -1,4 +1,4 @@
HISTFILE=${HISTFILE:-$ZDIR/transient/history} # The path to 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.

View File

@ -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

View File

@ -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

View File

@ -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'