I want to write a simple plugin for oh-my-zsh
completing only possible server arguments.
Example 1:
$ myserver st # hits tab
start stop
Example 2:
$ myserver # hits tab
start stop restart
According to wiki I have created file named ~/.oh-my-zsh/custom/plugins/myserver/myserver.plugin.zsh
with sample content of coffee plugin (I tried brew plugin as well) but completition doesn't work (any of described in file). Moreover error is thrown:
_arguments:comparguments:312: can only be called from completion function
I checked similar problems and my fpath
includes ~/.oh-my-zsh/custom/plugins/myserver
.
What am I missing? This should be pretty simple... Thanks for help
From your post I'd assume that you have named the file myserver.plugin.zsh
, however, if it is used to define a completion function its name must start with an underscore. It seems to be customary that the underscore is followed by the command name, i.e. in your case _myserver
.
However, without the explicit code you are using I can not help you any further. You might want to check this blog post for further help.
I should remark that it is completely unnecessary to design a completion function as oh-my-zsh
plugin; just create it as standalone piece of code.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With