zsh-users
 help / color / mirror / code / Atom feed
* completion for aliased commands does not work
@ 2016-10-31 22:47 Fourhundred Thecat
  0 siblings, 0 replies; 5+ messages in thread
From: Fourhundred Thecat @ 2016-10-31 22:47 UTC (permalink / raw)
  To: zsh-users

Hello,

I have couple of aliases defined in my .zshrc, ie:

  alias diff='colordiff'

I have noticed, completion does not work properly for these aliased commands

  diff --<TAB>

does not complete any options. Whereas, when I use the unaliased real
diff, completion works perfectly

  /usr/bin/diff --<TAB>

Is there any way to fix this?

Cheers,


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: completion for aliased commands does not work
  2016-11-01  5:29     ` Mikael Magnusson
@ 2016-11-01 18:53       ` Bart Schaefer
  0 siblings, 0 replies; 5+ messages in thread
From: Bart Schaefer @ 2016-11-01 18:53 UTC (permalink / raw)
  To: Zsh Users

On Nov 1,  6:29am, Mikael Magnusson wrote:
}
} That's actually not true, setting complete_aliases makes completion
} treat aliases as separate commands. :)

Er, I think I we're interpreting "see through" differently.  Obviously
given

    alias diff='colordiff'

then either

    setopt complete_aliases
or
    compdef colordiff=diff

will cause options for "diff" to be completed, instead of looking for
a completion for "colordiff".  On reflection I don't know why I took
Daniel's statement --

> } You'll find ... "diff <TAB>" and "colordiff <TAB>" behave the same

-- to mean that both should *work*.  The other interpretation of "see
through" makes more sense.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: completion for aliased commands does not work
  2016-10-31 23:33   ` Bart Schaefer
@ 2016-11-01  5:29     ` Mikael Magnusson
  2016-11-01 18:53       ` Bart Schaefer
  0 siblings, 1 reply; 5+ messages in thread
From: Mikael Magnusson @ 2016-11-01  5:29 UTC (permalink / raw)
  To: Bart Schaefer; +Cc: Zsh Users

On Tue, Nov 1, 2016 at 12:33 AM, Bart Schaefer
<schaefer@brasslantern.com> wrote:
> On Oct 31, 11:12pm, Daniel Shahaf wrote:
> } Subject: Re: completion for aliased commands does not work
> }
> } Fourhundred Thecat wrote on Mon, Oct 31, 2016 at 23:47:21 +0100:
> } >   alias diff='colordiff'
> } >   diff --<TAB>
> } >   /usr/bin/diff --<TAB>
> }
> } Completion "sees through" aliases.  You'll find that with the above
> } alias, "diff <TAB>" and "colordiff <TAB>" behave the same way.
>
> That's actually not true.  You have to "setopt complete_aliases" for
> completion to "see through".  If for some reason you do not want to
> set that, THEN:
>
> } Therefore, define a completion for colordiff:
> }
> }     compdef colordiff=diff
>

That's actually not true, setting complete_aliases makes completion
treat aliases as separate commands. :)

-- 
Mikael Magnusson


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: completion for aliased commands does not work
  2016-10-31 23:12 ` Daniel Shahaf
@ 2016-10-31 23:33   ` Bart Schaefer
  2016-11-01  5:29     ` Mikael Magnusson
  0 siblings, 1 reply; 5+ messages in thread
From: Bart Schaefer @ 2016-10-31 23:33 UTC (permalink / raw)
  To: zsh-users

On Oct 31, 11:12pm, Daniel Shahaf wrote:
} Subject: Re: completion for aliased commands does not work
}
} Fourhundred Thecat wrote on Mon, Oct 31, 2016 at 23:47:21 +0100:
} >   alias diff='colordiff'
} >   diff --<TAB>
} >   /usr/bin/diff --<TAB>
} 
} Completion "sees through" aliases.  You'll find that with the above
} alias, "diff <TAB>" and "colordiff <TAB>" behave the same way.

That's actually not true.  You have to "setopt complete_aliases" for
completion to "see through".  If for some reason you do not want to
set that, THEN:

} Therefore, define a completion for colordiff:
} 
}     compdef colordiff=diff


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: completion for aliased commands does not work
       [not found] <5817C9F9.2010809__36345.4683371403$1477954133$gmane$org@gmx.ch>
@ 2016-10-31 23:12 ` Daniel Shahaf
  2016-10-31 23:33   ` Bart Schaefer
  0 siblings, 1 reply; 5+ messages in thread
From: Daniel Shahaf @ 2016-10-31 23:12 UTC (permalink / raw)
  To: Fourhundred Thecat; +Cc: zsh-users

Fourhundred Thecat wrote on Mon, Oct 31, 2016 at 23:47:21 +0100:
>   alias diff='colordiff'
>   diff --<TAB>
>   /usr/bin/diff --<TAB>

Completion "sees through" aliases.  You'll find that with the above
alias, «diff <TAB>» and «colordiff <TAB>» behave the same way.
Therefore, define a completion for colordiff:

    compdef colordiff=diff


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-11-01 19:16 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-31 22:47 completion for aliased commands does not work Fourhundred Thecat
     [not found] <5817C9F9.2010809__36345.4683371403$1477954133$gmane$org@gmx.ch>
2016-10-31 23:12 ` Daniel Shahaf
2016-10-31 23:33   ` Bart Schaefer
2016-11-01  5:29     ` Mikael Magnusson
2016-11-01 18:53       ` Bart Schaefer

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).