This commit is contained in:
Joe Bloggs 2014-03-24 04:04:08 +00:00
parent db2dfce0b6
commit ffc9b48291
1 changed files with 3 additions and 3 deletions

View File

@ -7,7 +7,7 @@ and examples to get you up and running. If you need more details you can look it
Please make any scripts that you create publically available for others (e.g. by forking this repo and making a [[id:64bcd501-b0f0-48c7-b8e2-07af708b95ec][pull request]]).
* Getting started
** defining a completion function to use for a command
** Defining a completion function to use for a command
Completion functions for commands are stored in files with names beginning with an underscore _, and these files should
be placed in a directory listed in the $fpath variable.
You can add a directory to $fpath by adding a line like this to your ~/.zshrc file:
@ -32,13 +32,13 @@ or if you want to supply arguments:
> compdef '_function arg1 arg2' foobar
#+END_SRC
See [[http://zsh.sourceforge.net/Doc/Release/Completion-System.html#Functions-4][here]] for more details.
** completing generic gnu commands
** Completing generic gnu commands
Many [[http://www.gnu.org/][gnu]] commands have a standardized way of listing option descriptions (when the --help option is used).
For these commands you can use the _gnu_generic function for automatically creating completions, like this:
#+BEGIN_SRC sh
> compdef _gnu_generic foobar
#+END_SRC
** using completions from one command for completing another command
** Using completions from one command for completing another command
If you want a command, say cmd1, to have the same completions as another, say cmd2, you can do this:
#+BEGIN_SRC sh
> compdef cmd1=cmd2