-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
113 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,45 @@ | ||
load_completion_from_cmd() { | ||
local cmd=$1 | ||
shift | ||
local args=$@ | ||
local completion_file=$ZSH_CACHE_DIR/completions/_$cmd | ||
if ! (( $+commands[$cmd] )); then | ||
return | ||
fi | ||
local args=("${@:2}") | ||
local completion_file="${ZSH_CACHE_DIR}/completions/_${cmd}" | ||
|
||
[[ -n $commands[$cmd] ]] || return | ||
|
||
if [[ ! -f $completion_file ]]; then | ||
typeset -g -A _comps | ||
autoload -Uz _$cmd | ||
_comps[$cmd]=_$cmd | ||
fi | ||
|
||
eval "$cmd ${args[*]}" >| $completion_file &| | ||
} | ||
|
||
GENCOMPL_FPATH=$HOME/.zsh/complete | ||
# Constants at the top | ||
GENCOMPL_FPATH="${HOME}/.zsh/complete" | ||
|
||
# Initialize completion system | ||
autoload -U +X bashcompinit && bashcompinit | ||
|
||
# Group related paths together | ||
fpath+=( | ||
$ZSH_CACHE_DIR/completions | ||
/opt/homebrew/share/zsh/site-functions | ||
$ASDF_DIR/completions | ||
$GENCOMPL_FPATH | ||
"${ZSH_CACHE_DIR}/completions" | ||
"/opt/homebrew/share/zsh/site-functions" | ||
"${ASDF_DIR}/completions" | ||
"${GENCOMPL_FPATH}" | ||
) | ||
|
||
# Group related completions together | ||
# Infrastructure tools | ||
complete -o nospace -C terraform terraform | ||
complete -o nospace -C terragrunt terragrunt | ||
complete -o nospace -C 'aws_completer' aws | ||
|
||
# Development tools | ||
load_completion_from_cmd docker completion zsh | ||
load_completion_from_cmd argocd completion zsh | ||
load_completion_from_cmd kubectl completion zsh | ||
load_completion_from_cmd helm completion zsh | ||
|
||
# CLI tools | ||
load_completion_from_cmd gh completion --shell zsh | ||
load_completion_from_cmd kubectl completion zsh | ||
load_completion_from_cmd argocd completion zsh | ||
load_completion_from_cmd wezterm shell-completion --shell zsh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters