]> arthur.barton.de Git - ax-zsh.git/commitdiff
Rework FPATH and completion system
authorAlexander Barton <alex@barton.de>
Sat, 18 Jul 2015 16:02:28 +0000 (18:02 +0200)
committerAlexander Barton <alex@barton.de>
Sat, 18 Jul 2015 16:02:28 +0000 (18:02 +0200)
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
ax.zsh
core/05_fpath/05_fpath.zprofile [new file with mode: 0644]
core/05_fpath/05_fpath.zshrc [new file with mode: 0644]
core/50_completion/50_completion.zshrc [new file with mode: 0644]
core/90_completion_init/90_completion_init.zshrc [deleted file]
plugins/completion/completion.zshrc [deleted file]
plugins/homebrew/homebrew.zprofile [new file with mode: 0644]
plugins/homebrew/homebrew.zshrc [deleted file]

index 45671dbf0ee6b3b1f9c6e221d90935fac1e8b096..fb86bdec4d54d33da9cecfb2871789d8d3d87676 100644 (file)
--- 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 56379dcd2a43aafa4fde80ac9d8d803e8a1cf6b0..d0579602ae9b5a945e283085ee7f40a4ab746916 100644 (file)
--- 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 (file)
index 0000000..22795b9
--- /dev/null
@@ -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 (file)
index 0000000..94e6620
--- /dev/null
@@ -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/core/50_completion/50_completion.zshrc b/core/50_completion/50_completion.zshrc
new file mode 100644 (file)
index 0000000..d1df7b8
--- /dev/null
@@ -0,0 +1,22 @@
+# AX-ZSH: Alex' Modular ZSH Configuration
+# 50_completion.zshrc: Setup completion
+
+autoload -U compinit
+
+setopt completealiases
+
+zstyle ':completion:*' list-colors ''
+zstyle ':completion:*' menu select
+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 (file)
index ed7ff16..0000000
+++ /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/completion/completion.zshrc b/plugins/completion/completion.zshrc
deleted file mode 100644 (file)
index 7588385..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-# AX-ZSH: Alex' Modular ZSH Configuration
-# completion.zshrc: Setup completion
-
-autoload -U compinit
-
-setopt completealiases
-
-zstyle ':completion:*' list-colors ''
-zstyle ':completion:*' menu select
-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"
diff --git a/plugins/homebrew/homebrew.zprofile b/plugins/homebrew/homebrew.zprofile
new file mode 100644 (file)
index 0000000..670a349
--- /dev/null
@@ -0,0 +1,8 @@
+# AX-ZSH: Alex' Modular ZSH Configuration
+# homebrew.zprofile -- Setup Homebrew Package Manager
+
+# Make sure that "brew(1)" is installed
+(( $+commands[brew] )) || return
+
+[[ -d "/usr/local/share/zsh-completions" ]] \
+       && axzsh_fpath=(/usr/local/share/zsh-completions $axzsh_fpath)
diff --git a/plugins/homebrew/homebrew.zshrc b/plugins/homebrew/homebrew.zshrc
deleted file mode 100644 (file)
index 24731ca..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-# AX-ZSH: Alex' Modular ZSH Configuration
-# homebrew.zshrc -- 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)