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

Re: Completion alias



On Mar 23, 12:29pm, Peter Stephenson wrote:
} Subject: Re: Completion alias
}
} =?UTF-8?Q?J=C3=B6rg?= Sommer wrote:
} > But how can I use this for a completion of a command with an argument,
} > i.e. agi should have the same completion as 'agt-get install'
} 
} That would require some rewriting of _apt.

In this specific instance, if "agi" really is just shorthand for the
entirely equivalent "apt-get install", then:

    alias agi='apt-get install'
    unsetopt complete_aliases

I think it should also work to do

    _agi () {
	shift words
	service=apt-get
	words=(apt-get install $words) 
	((CURRENT++))                    
	_apt
    }
    compdef _agi agi

However, there may be something else that needs to be twaddled as well
as service= and words= to guarantee that this works properly.



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