1
0
Fork 0
mirror of synced 2024-11-22 23:35:35 -05:00

add compdef for pacman aliases

The recommended order for the module loading has been changed. The last
module to be loaded should be 'completion'. This ensures all completions
set by other modules are dumped and included in the completion.
Because of this, any compdefs like this one (making the pacman aliases
use pacman completion) must be set in the compdefs.zsh file, and loaded
with the completion module. This means the compdefs must be wrapped with
conditional statements to ensure such aliases/functions have been set by
previous modules. I may abstract this conditional to a function in the
future to make this an easier process.
This commit is contained in:
Matt Hamilton 2015-12-17 02:12:02 -05:00
parent a8aa59e09d
commit 01838f0083
3 changed files with 18 additions and 1 deletions

View file

@ -0,0 +1,14 @@
#
# Alias compdefs
#
# Any aliased commands will not function with completion without compdefs.
# Because completion is the LAST module to be loaded (so we make sure to catch all completions)
# we must assign the compdefs here, as opposed to within the modules themselves.
# Unfortunately, I'm not aware of a worthwhile way to ensure that these will be included in .zcompdump
# zpacman_frontend -> pacman
if (( ${+zpacman_frontend} )); then
compdef ${zpacman_frontend}='pacman'
fi

View file

@ -17,6 +17,10 @@ fpath=(${0:h}/external/src ${fpath})
# load and initialize the completion system # load and initialize the completion system
autoload -Uz compinit && compinit -C -d ${ZDOTDIR:-$HOME}/.zcompdump autoload -Uz compinit && compinit -C -d ${ZDOTDIR:-$HOME}/.zcompdump
# set any compdefs
source ${0:h}/compdefs.zsh
{ {
# zcomple the .zcompdump in the background # zcomple the .zcompdump in the background
local zcompdump=${ZDOTDIR:-$HOME}/.zcompdump local zcompdump=${ZDOTDIR:-$HOME}/.zcompdump

View file

@ -9,7 +9,6 @@
# General # General
# #
alias pacman=${zpacman_frontend}
alias pac=${zpacman_frontend} alias pac=${zpacman_frontend}
# #