From f038b6bddc5d2a3a2ef283a177fd6377697a31d3 Mon Sep 17 00:00:00 2001 From: Sinkerine Date: Sat, 24 Mar 2018 11:40:39 -0400 Subject: [PATCH] [!] optimize --- lib/misc.zsh | 4 ++-- oh-my-zsh.sh | 19 +++++++++++++++++-- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/lib/misc.zsh b/lib/misc.zsh index 3052b7710..f5b710778 100644 --- a/lib/misc.zsh +++ b/lib/misc.zsh @@ -19,8 +19,8 @@ fi setopt long_list_jobs ## pager -env_default PAGER 'less' -env_default LESS '-R' +[[ -n "$PAGER" ]] || export PAGER='less' +[[ -n "$PAGER" ]] || export PAGER='less' ## super user alias alias _='sudo' diff --git a/oh-my-zsh.sh b/oh-my-zsh.sh index 7f78e4140..08c2b8a35 100644 --- a/oh-my-zsh.sh +++ b/oh-my-zsh.sh @@ -64,6 +64,11 @@ if [ -z "$ZSH_COMPDUMP" ]; then ZSH_COMPDUMP="${ZDOTDIR:-${HOME}}/.zcompdump-${SHORT_HOST}-${ZSH_VERSION}" fi +# On slow systems, checking the cached .zcompdump file to see if it must be +# regenerated adds a noticable delay to zsh startup. This little hack restricts +# it to once a day. It should be pasted into your own completion file. +#https://gist.github.com/ctechols/ca1035271ad134841284 +setopt extendedglob if [[ $ZSH_DISABLE_COMPFIX != true ]]; then # If completion insecurities exist, warn the user without enabling completions. if ! compaudit &>/dev/null; then @@ -71,10 +76,20 @@ if [[ $ZSH_DISABLE_COMPFIX != true ]]; then handle_completion_insecurities # Else, enable and cache completions to the desired file. else - compinit -d "${ZSH_COMPDUMP}" + if [[ -n "${ZSH_COMPDUMP}"(#qN.mh+24) ]]; then + compinit -d "${ZSH_COMPDUMP}" + compdump + else + compinit -C + fi fi else - compinit -i -d "${ZSH_COMPDUMP}" + if [[ -n "${ZSH_COMPDUMP}"(#qN.mh+24) ]]; then + compinit -i -d "${ZSH_COMPDUMP}" + compdump + else + compinit -C + fi fi # Load all of the plugins that were defined in ~/.zshrc