Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: How to complete alias after alias of sudo?



On Wed, May 31, 2017 at 09:43:10AM +0100, Peter Stephenson wrote:
> On Wed, 31 May 2017 14:46:55 +0800
> Han Pingtian <hanpt@xxxxxxxxxxxxxxxxxx> wrote:
> > But looks like I cannot complete the second alias by <tab>:
> > 
> >     % sd f<tab>
> >     external command
> >     fold                                   foomatic-kitload
> >     ...
> > 
> > only external commands listed.
> 
> This is down to how completion for "sd" is defined.  As far as I can see
> that's not a standard completion --- I would guess it's simply adding
> external commands rather than all commands in that context.  (I've
> confirmed that _precommand, which is the nearest standard completion
> that I can think of, does complete aliases in the corresponding case.)
> 
> pws

Looks like if change the line 52 of _sudo from

    52     '(-)1:command: _command_names -e'

to

    52     '(-)1:command: _command_names'

then alias will be listed. But looks like it's not a good idea to
complete alias after sudo? I'll try to remember all those aliases and
type them directly.


Thanks.



Messages sorted by: Reverse Date, Date, Thread, Author