completion 

Send to Kindle
home » snippets » zsh » completion



Plugins / Examples (not necessarily for zsh)

The Context

:<zsh_system:completion|zle>:<func>:<completer>:<command>:<argument>:<tag>

Here,

Part Description
zsh_system Always completion when looked up by the completion system.  It's zle when used by zle widgets.
func Often empty.  Holds the name of the invoking function.  e.g. if you bound \C-xe to _expand_word, then this would be expand-word.  It's complete-word for _correct_word
completer Such as complete, expand, correct, prefix, match, etc.
command The name of the command when completing a command, or a pseudo name such as -subscript-, -default-, -parameter-, -redirect-, etc.  (These are keys of the _comps hash)
argument Most useful when command is a real command.  It describes where in the arguments to that command we are.  e.g. argument-rest, argument-1, option-o-1, etc.
tag TODO

Snippets

compdef what=whence

# The :r removes the suffix from the result, and the :t takes away the directory part.
_ck_complete_vs() { compadd $VIMWS/*.vs(.:r:t) }
compdef _ck_complete_vs vs


# try this to learn some new cool things
# _subscript handles completion for the "-subscript-" context
# e.g. if you type "print ${_comps[" and press ^D
which _subscript