Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: alias of completion
- X-seq: zsh-users 23197
- From: Pier Paolo Grassi <pierpaolog@xxxxxxxxx>
- To: m0viefreak <m0viefreak.cm@xxxxxxxxxxxxxx>
- Subject: Re: alias of completion
- Date: Fri, 2 Mar 2018 13:15:51 +0100
- Cc: zsh-users@xxxxxxx
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=zVBwguUenlvxQBfdWEhlBKm4aGuugOrNihGPa912stw=; b=ER48WR9jxt79H/+qRIRFbGKlcYCY7NwU5bydpUbPgppp3POpok0JRvQuyq4LlT2HTp hfo9OEVRkR1prm8zLynXdGQHpk+K+PbbQD9TybiC5Gq5qU3dZL5GyPowkRuawn1rrA12 /qtbjVKMIc+DBTjIBNXW6D6tyJAazfepkfbooK8AlAeOkyxM97j/6xPrOcyQk8RwOehp za7KAOzGixMLX9AflVuxBZuj0mWwSkox6Ly7p+v09ANNlGotRpzAmKVO4CVj+t5MLD0f ETRXcqSuTCLoBAy01CRkAz1U9qZYqzHLhGMJrx6RQG8DBceJrwo6mPzfJq9WVr2qEnQW bWkg==
- In-reply-to: <9b7ec742-8786-452b-26b7-c064d855f7c2@googlemail.com>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- List-unsubscribe: <mailto:zsh-users-unsubscribe@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <CAP+y1xCmn1bDmajXY39N=TOgdRbjGLdGVMJrUPnpq_--6+3QFA@mail.gmail.com> <9b7ec742-8786-452b-26b7-c064d855f7c2@googlemail.com>
YES that does it! thank you! I knew it must have to be very simple, I just
was missing some information..
2018-03-02 13:08 GMT+01:00 m0viefreak <m0viefreak.cm@xxxxxxxxxxxxxx>:
>
>
> On 02.03.2018 10:31, Pier Paolo Grassi wrote:
> > Hello guys, I just joined the list but I have been a zsh enthusiast for
> 15
> > years and since I discovered it it's always been the best work
> enviroment I
> > ever had.
> > One thing I was never been able to accomplish though, is: what if I want
> a
> > custom function, say:
> >
> > mydockerwrapper(){}
> >
> > behave, for completion's sake, like, let's say:
> >
> > docker ls
> >
> > so that if I try to complete after
> >
> > mydockerwrapper <TAB>
> >
> > I get the same suggestion that I would get after docker ls, and if I have
> >
> > mydockerwrapper xx <TAB>
> >
> > I get the same completion that I would get after docker ls xx, and so
> on.
> >
> > -what I tried-
> >
> > I know that the completion function for the docker command is _docker,
> and
> > that I could associate my function to this completion function with
> >
> > compdef _docker mydockerwrapper
> >
> > but it doesn't seem possibile to pass one default argument to the
> > completion function in this way.
> >
> > So I tried defining my own completion function, and add one argument and
> > pass it to the _docker function, but I got stuck on this one.
> >
> > I'm sure this must be very easy to do in zsh, I just can't figure out
> how..
> > maybe someone can help me out?
> >
> > thanks, happy coding everyone!
> >
> >
>
> You could modify CURRENT and words in a custom completion function and
> then just call _normal ("docker ls" is one word more than
> "mydockerwrapper"):
>
> _mydockerwrapper() {
> ((CURRENT++))
> words=(docker ls "${words[@]:1}")
> _normal
> }
> compdef _mydockerwrapper mydockerwrapper
>
>
--
Pier Paolo Grassi
email: pierpaolog@xxxxxxxxx
linkedin: https://www.linkedin.com/in/pier-paolo-grassi-19300217
fondatore: https://www.meetup.com/it-IT/Machine-Learning-TO
Messages sorted by:
Reverse Date,
Date,
Thread,
Author