Zsh autocompletion
From wikinotes
Documentation
official docs http://zsh.sourceforge.net/Doc/Release/Completion-System.html
Tutorials
completion funcs https://github.com/zsh-users/zsh-completions/blob/master/zsh-completions-howto.org intro to autocomp https://askql.wordpress.com/2011/01/11/zsh-writing-own-completion/ intermediate autocomp http://www.linux-mag.com/id/1106/
Locations
/usr/share/zsh/functions/Completion/*/*
completion scripts (see $fpath
)
Notes
zsh completion configuration
Syntax
zsh completion basics zsh completion testing zsh completion examples Completer Functions zsh completion _arguments zsh completion _describe zsh completion _alternative
Syntax
Filesystem and Setup
Each program has it's own autocompletion script. It is named after the program with a prefix of '_'. The first line in the program should be '#compdef <programName>'
touch ~/.zsh/completion/_hello #### ~/.zsh/completion/_hello #compdef hello ... ####Actions
_normal --> A normal argument. Expects a word (this seems to be the default) _files --> Complete filepaths _net_interfaces --> Net Interfaces _users --> users _groups --> groups _parameters --> expect a word argument to follow (can be file, word... pretty much anything. Can be restricted.)