Zsh autocompletion: Difference between revisions

From wikinotes
 
(One intermediate revision by the same user not shown)
Line 56: Line 56:
|}
|}
</blockquote><!-- Syntax -->
</blockquote><!-- Syntax -->
= Syntax =
<blockquote>
== Filesystem and Setup ==
<blockquote>
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>'
<source lang="bash">
touch ~/.zsh/completion/_hello
#### ~/.zsh/completion/_hello
#compdef hello
...
####
</source>
</blockquote><!-- filesystem and setup -->
== Actions ==
<blockquote>
<source lang="bash">
_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.)
</source>
</blockquote><!-- Actions -->

Latest revision as of 22:58, 24 July 2021