Skip to content

Commit

Permalink
Improve output in command position
Browse files Browse the repository at this point in the history
  • Loading branch information
marlonrichert committed Nov 12, 2021
1 parent 424ec91 commit bcdb53f
Showing 1 changed file with 19 additions and 11 deletions.
30 changes: 19 additions & 11 deletions scripts/.autocomplete.config
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,15 @@ builtin zstyle ':completion:history-incremental-*search-*:*' completer \
builtin zstyle ':completion:*:expand:*' tag-order '! all-expansions original' -
builtin zstyle -e ':completion:*:-command-:*' tag-order _autocomplete.config.tag-order.command
_autocomplete.config.tag-order.command() {
reply=( '(|*-)directories executables suffix-aliases' )
if [[ -z $PREFIX$SUFFIX ]]; then
reply+=( - )
reply=( 'suffix-aliases (|*-)directories executables (|*-)files' - )
else
reply+=( 'aliases functions builtins reserved-words commands' )
reply=( aliases suffix-aliases functions 'reserved-words builtins' )
if [[ -n $path[(r).] ]]; then
reply+=( '(|*-)directories executables (|*-)files' commands )
else
reply+=( commands '(|*-)directories executables (|*-)files' )
fi
fi
}
builtin zstyle ':completion:list-expand:*:-command-:*' tag-order '*'
Expand All @@ -64,32 +68,36 @@ builtin zstyle ':completion:*-fuzzy:*' matcher-list \
builtin zstyle ':completion:*:options' matcher 'b:-=+'

builtin zstyle ':completion:*' prefix-needed yes
builtin zstyle ':completion:*:expand:*' accept-exact continue
builtin zstyle ':completion:*:expand-alias:*' complete yes
builtin zstyle ':completion:*' ignore-parents 'parent pwd directory'

builtin zstyle ':completion:*:-command-:*' ignore-line current
builtin zstyle ':completion:*:users' ignored-patterns '_*'
builtin zstyle ':completion:*:widgets' ignored-patterns '.*' '*:*' '*orig-*'

builtin zstyle ':completion:*:expand:*' accept-exact continue
builtin zstyle -e ':completion:*:expand:*' glob _autocomplete.is_glob
builtin zstyle ':completion:*:expand:*' keep-prefix no # Needed for file type highlighting
builtin zstyle ':completion:*:expand:*' add-space subst

builtin zstyle ':completion:*:expand-alias:*' complete yes

# Complete only the tail of a path.
builtin zstyle ':completion:*' ignore-parents 'parent pwd directory'
builtin zstyle ':completion:*:paths' expand suffix
builtin zstyle ':completion:*:paths' list-suffixes yes
builtin zstyle ':completion:*:paths' path-completion no

builtin zstyle ':completion:*' group-name ''
builtin zstyle ':completion:*' group-order \
expansions options \
globbed-files local-directories directories executables suffix-aliases \
aliases functions builtins reserved-words commands
aliases suffix-aliases functions reserved-words builtins commands \
local-directories directories executables

builtin zstyle ':completion:*' complete-options yes
builtin zstyle ':completion:*' list-dirs-first yes

builtin zstyle ':completion:*:(.|source):*' file-patterns '^*.zwc(-.^*)' '^*.zwc(-^/)'
builtin zstyle ':completion:*' file-patterns \
'*(-/):directories:directory %p(#q^-/):files' \
'*(D-/):directories:directory %p(#qD^-/):files'
builtin zstyle ':completion:*:(.|source):*' file-patterns \
'%p~*.zwc(-.^*)' '%p~*.zwc(-^/)'

builtin zstyle ':completion:*:descriptions' format $'%{\e[1;2;39m%}%d%{\e[0m%}'
builtin zstyle ':completion:*:warnings' format $'%{\e[1;2;39m%}no such %d%{\e[0m%}'
Expand Down

0 comments on commit bcdb53f

Please sign in to comment.