From ca017856edb82f2a1a3d9a6b800d8fc0042d511e Mon Sep 17 00:00:00 2001 From: Alexander Barton Date: Sat, 18 Jul 2015 18:02:28 +0200 Subject: [PATCH] Rework FPATH and completion system Now AX-ZSH manages its own additional FPATH components, and adds these to the actual FPATH after reading all zprofile files and before handling all the zshrc files. This allows plugins to add custom FPATH directories in their zprofile part, and to configure completion settings in their zshrc file: "compinit" is called by the ax.zsh script between these two steps. --- README.md | 1 - ax.zsh | 1 - core/05_fpath/05_fpath.zprofile | 4 ++++ core/05_fpath/05_fpath.zshrc | 6 ++++++ .../50_completion/50_completion.zshrc | 10 +++++++++- core/90_completion_init/90_completion_init.zshrc | 13 ------------- .../homebrew/{homebrew.zshrc => homebrew.zprofile} | 4 ++-- 7 files changed, 21 insertions(+), 18 deletions(-) create mode 100644 core/05_fpath/05_fpath.zprofile create mode 100644 core/05_fpath/05_fpath.zshrc rename plugins/completion/completion.zshrc => core/50_completion/50_completion.zshrc (58%) delete mode 100644 core/90_completion_init/90_completion_init.zshrc rename plugins/homebrew/{homebrew.zshrc => homebrew.zprofile} (58%) diff --git a/README.md b/README.md index 45671db..fb86bde 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,6 @@ The following configuration variables are supported: addition to the core plugins. You can reset this array to disable(!) loading of these default plugins. Currently these plugins are loaded by default: * byebye - * completion * correction * history * ls diff --git a/ax.zsh b/ax.zsh index 56379dc..d057960 100644 --- a/ax.zsh +++ b/ax.zsh @@ -67,7 +67,6 @@ typeset -U axzsh_default_plugins if ! typeset +m axzsh_default_plugins | fgrep array >/dev/null 2>&1; then axzsh_default_plugins=( byebye - completion correction history ls diff --git a/core/05_fpath/05_fpath.zprofile b/core/05_fpath/05_fpath.zprofile new file mode 100644 index 0000000..22795b9 --- /dev/null +++ b/core/05_fpath/05_fpath.zprofile @@ -0,0 +1,4 @@ +# AX-ZSH: Alex' Modular ZSH Configuration +# 05_fpath.zprofile: Setup AX-ZSH "fpath" + +typeset -xTU AXZSH_FPATH axzsh_fpath diff --git a/core/05_fpath/05_fpath.zshrc b/core/05_fpath/05_fpath.zshrc new file mode 100644 index 0000000..94e6620 --- /dev/null +++ b/core/05_fpath/05_fpath.zshrc @@ -0,0 +1,6 @@ +# AX-ZSH: Alex' Modular ZSH Configuration +# 05_fpath.zshrc: Setup AX-ZSH "fpath" + +typeset -xTU AXZSH_FPATH axzsh_fpath + +[[ -n "$AXZSH_FPATH" ]] && fpath=($axzsh_fpath $fpath) diff --git a/plugins/completion/completion.zshrc b/core/50_completion/50_completion.zshrc similarity index 58% rename from plugins/completion/completion.zshrc rename to core/50_completion/50_completion.zshrc index 7588385..d1df7b8 100644 --- a/plugins/completion/completion.zshrc +++ b/core/50_completion/50_completion.zshrc @@ -1,5 +1,5 @@ # AX-ZSH: Alex' Modular ZSH Configuration -# completion.zshrc: Setup completion +# 50_completion.zshrc: Setup completion autoload -U compinit @@ -12,3 +12,11 @@ zstyle ':completion:*' special-dirs true # Use caching so that commands like apt and dpkg completions are useable zstyle ':completion::complete:*' use-cache 1 zstyle ':completion::complete:*' cache-path "$ZSH_CACHE_DIR" + +# Save the location of the current completion dump file. +if [[ -z "$ZSH_COMPDUMP" ]]; then + ZSH_COMPDUMP="${ZDOTDIR:-$HOME}/.zcompdump-${SHORT_HOST}-${ZSH_VERSION}" +fi + +# Initialize ZSH completion system +compinit -d "$ZSH_COMPDUMP" diff --git a/core/90_completion_init/90_completion_init.zshrc b/core/90_completion_init/90_completion_init.zshrc deleted file mode 100644 index ed7ff16..0000000 --- a/core/90_completion_init/90_completion_init.zshrc +++ /dev/null @@ -1,13 +0,0 @@ -# AX-ZSH: Alex' Modular ZSH Configuration -# completion.zshrc: Setup completion - -# Make sure that "compinit" is available -type compinit >/dev/null || return - -# Save the location of the current completion dump file. -if [[ -z "$ZSH_COMPDUMP" ]]; then - ZSH_COMPDUMP="${ZDOTDIR:-$HOME}/.zcompdump-${SHORT_HOST}-${ZSH_VERSION}" -fi - -# Initialize ZSH completion system -compinit -d "$ZSH_COMPDUMP" diff --git a/plugins/homebrew/homebrew.zshrc b/plugins/homebrew/homebrew.zprofile similarity index 58% rename from plugins/homebrew/homebrew.zshrc rename to plugins/homebrew/homebrew.zprofile index 24731ca..670a349 100644 --- a/plugins/homebrew/homebrew.zshrc +++ b/plugins/homebrew/homebrew.zprofile @@ -1,8 +1,8 @@ # AX-ZSH: Alex' Modular ZSH Configuration -# homebrew.zshrc -- Setup Homebrew Package Manager +# homebrew.zprofile -- Setup Homebrew Package Manager # Make sure that "brew(1)" is installed (( $+commands[brew] )) || return [[ -d "/usr/local/share/zsh-completions" ]] \ - && fpath=(/usr/local/share/zsh-completions $fpath) + && axzsh_fpath=(/usr/local/share/zsh-completions $axzsh_fpath) -- 2.39.2