* trouble trying to understand zsh's completion system
@ 2017-10-11 10:37 Filipe Silva
2017-10-11 17:54 ` Daniel Shahaf
0 siblings, 1 reply; 2+ messages in thread
From: Filipe Silva @ 2017-10-11 10:37 UTC (permalink / raw)
To: Zsh Users
[-- Attachment #1: Type: text/plain, Size: 318 bytes --]
So I saved this file as _gocomp in a directory:
#compdef go
local -a options
options=('run:description for run' 'build:description for build')
_describe 'values' options
after $ fpath=($(readlink -f .) $fpath) and autload -U _gocomp, I try to
type go [TAB]. zsh greets me with `go _gocomp`.
What am I doing wrong?
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: trouble trying to understand zsh's completion system
2017-10-11 10:37 trouble trying to understand zsh's completion system Filipe Silva
@ 2017-10-11 17:54 ` Daniel Shahaf
0 siblings, 0 replies; 2+ messages in thread
From: Daniel Shahaf @ 2017-10-11 17:54 UTC (permalink / raw)
To: Filipe Silva, Zsh Users
Filipe Silva wrote on Wed, 11 Oct 2017 07:37 -0300:
> So I saved this file as _gocomp in a directory:
>
> #compdef go
>
> local -a options
> options=('run:description for run' 'build:description for build')
> _describe 'values' options
>
> after $ fpath=($(readlink -f .) $fpath) and autload -U _gocomp, I try to
> type go [TAB]. zsh greets me with `go _gocomp`.
>
> What am I doing wrong?
You aren't making the link between the command "go" and the autoloadable
function "_gocomp".
You can do that either by running compinit after changing fpath (then
you don't need to run autoload explicitly) or by running 'compdef
_gocomp go' in addition to what you're running.
It completes "_gocomp" because that's the only file in the current
directory. (_files is the default completion)
Minimal example:
zsh -f
autoload compinit
compinit
_foo() { compadd bar }
compdef _foo foo
foo <TAB>
Cheers,
Daniel
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-10-11 17:54 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-11 10:37 trouble trying to understand zsh's completion system Filipe Silva
2017-10-11 17:54 ` Daniel Shahaf
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).