This commit is contained in:
Joe Bloggs 2014-03-24 03:13:23 +00:00
parent ea01659a66
commit b27db238c9
1 changed files with 20 additions and 1 deletions

View File

@ -14,15 +14,34 @@ You can add a directory to $fpath by adding a line like this to your ~/.zshrc fi
#+BEGIN_SRC sh #+BEGIN_SRC sh
fpath=(~/newdir $fpath) fpath=(~/newdir $fpath)
#+END_SRC #+END_SRC
The first line of a completion function file can look something like this:
#+BEGIN_SRC sh
#compdef foobar
#+END_SRC
This tells zsh that the file contains code for completing the foobar command.
This is the format that you will use most often for the first line, but you can also use the same file for completing
several different functions if you want. See [[http://zsh.sourceforge.net/Doc/Release/Completion-System.html#Autoloaded-files][here]] for more details.
You can also use the compdef command directly on the command line to tell zsh which function to use for completing a
command like this:
#+BEGIN_SRC sh
> compdef _function foobar
#+END_SRC
or if you want to supply arguments:
#+BEGIN_SRC sh
> compdef '_function arg1 arg2' foobar
#+END_SRC
See [[http://zsh.sourceforge.net/Doc/Release/Completion-System.html#Functions-4][here]] for more details.
* Utility functions with example code * Utility functions with example code
** compadd ** compadd
** _gnu_generic ** _gnu_generic
** _arguments ** _arguments
** _regex_arguments ** _regex_arguments
** _regex_words ** _regex_words
** _values ** _values
** _comma_separated ** _comma_separated
** _files
** _net_interfaces
* gotchas * gotchas
* Putting it all together * Putting it all together
* Other resources * Other resources