Browse Source

Cache the completion for a quicker startup

The original idea was by @samjonester in #1210. This version aims to avoid
relying on the stat or date programs because they have different flags depending
on the OS and if it uses BSD or GNU coreutils.
master
Kaleb Elwert 8 years ago
parent
commit
871b15663c
  1. 15
      modules/completion/init.zsh

15
modules/completion/init.zsh

@ -14,9 +14,6 @@ fi
# Add zsh-completions to $fpath. # Add zsh-completions to $fpath.
fpath=("${0:h}/external/src" $fpath) fpath=("${0:h}/external/src" $fpath)
# Load and initialize the completion system ignoring insecure directories.
autoload -Uz compinit && compinit -i
# #
# Options # Options
# #
@ -27,9 +24,21 @@ setopt PATH_DIRS # Perform path search even on command names with slas
setopt AUTO_MENU # Show completion menu on a successive tab press. setopt AUTO_MENU # Show completion menu on a successive tab press.
setopt AUTO_LIST # Automatically list choices on ambiguous completion. setopt AUTO_LIST # Automatically list choices on ambiguous completion.
setopt AUTO_PARAM_SLASH # If completed parameter is a directory, add a trailing slash. setopt AUTO_PARAM_SLASH # If completed parameter is a directory, add a trailing slash.
setopt EXTENDED_GLOB # Needed for file modification glob modifiers with compinit
unsetopt MENU_COMPLETE # Do not autoselect the first completion entry. unsetopt MENU_COMPLETE # Do not autoselect the first completion entry.
unsetopt FLOW_CONTROL # Disable start/stop characters in shell editor. unsetopt FLOW_CONTROL # Disable start/stop characters in shell editor.
# Load and initialize the completion system ignoring insecure directories with a
# cache time of 20 hours, so it should almost always regenerate the first time a
# shell is opened each day.
autoload -Uz compinit
compfiles=(${ZDOTDIR:-$HOME}/.zcompdump(Nm-20))
if [[ $#compfiles > 0 ]]; then
compinit -i -C
else
compinit -i
fi
# #
# Styles # Styles
# #

Loading…
Cancel
Save