Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: tab completion in an alias
- X-seq: zsh-users 14885
- From: Peter Stephenson <pws@xxxxxxx>
- To: zsh-users@xxxxxxx
- Subject: Re: tab completion in an alias
- Date: Thu, 25 Feb 2010 14:12:19 +0000
- In-reply-to: <20100224052122.GA27211@xxxxxxxxxxxxxxxxxxxxx>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- Organization: CSR
- References: <20100224052122.GA27211@xxxxxxxxxxxxxxxxxxxxx>
On Tue, 23 Feb 2010 21:21:36 -0800
John Magolske <listmail@xxxxxxx> wrote:
> alias d='cd - '
>
> So that I could type d, then the enter key, and be presented with the
> directory stack as a menu to scroll down through. Is there some way to
> accomplish this?
The following seemed to work (4.3.10)...
zle-line-init() {
if [[ -n $ZLE_PUSH_STRING ]]; then
zle -U "$ZLE_PUSH_STRING"
unset ZLE_PUSH_STRING
fi
}
zle -N zle-line-init
alias d="ZLE_PUSH_STRING=\$'cd -\\C-i'"
This causes it to preload the string into the line editor as a string of
characters at the start. They have to be raw characters to make the tab
active; that's the simplest way I found of doing it. There are no doubt
entirely different ways of geting a similar effect.
--
Peter Stephenson <pws@xxxxxxx> Software Engineer
Tel: +44 (0)1223 692070 Cambridge Silicon Radio Limited
Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, UK
Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom
Messages sorted by:
Reverse Date,
Date,
Thread,
Author