Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: tab completion in an alias
- X-seq: zsh-users 14886
- From: Mikael Magnusson <mikachu@xxxxxxxxx>
- To: John Magolske <listmail@xxxxxxx>
- Subject: Re: tab completion in an alias
- Date: Thu, 25 Feb 2010 15:14:59 +0100
- Cc: zsh-users@xxxxxxx
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type; bh=xQcjbPw6pghYKvynb+ukyEQqITdMp3PYE52VAjjqJi4=; b=dPzHs8i7OY2neRNjTYhuzrdejiF/CJnjUHJjvWyJkE4t/1XTXyF7e52OSg7VIpdZu9 vF1+3zpb8DSjhhtpj6nwkbsOk4MpbcmViATG/wEYnhKtuUG8ExR0zRxemf5uyFSTtNFs SGnPyXHsFUNFQ1El8mCaRXdHyO4wCqco/4IQs=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=nkqqtWqqaLY0Z/wBv34IOSHAvVRPzx+G5LqEi9HAvKb2fdYHc0yfPRNg21eY9xsCyL 9NxINxd0wGVJnPg+ciYOtTldPlnbrgP3Cq3/vHbgaya5gtn+wRCJEak0l58tp0pYDciV TysoUAXW/ggEULrhsBf7Ql8idzfsKyHd8rbxQ=
- 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
- References: <20100224052122.GA27211@xxxxxxxxxxxxxxxxxxxxx>
On 24 February 2010 06:21, John Magolske <listmail@xxxxxxx> wrote:
> I was impressed to read in the recent post on dirs & popd how
>
> cd -<tab>
>
> allows one to tabcomplete the directory stack & scroll down through it
> with the <down> key. I'd like to wrap this in an alias that includes
> the <tab>, something like (and I know this doesn't work):
>
> 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?
I can only think of one, but it's probably too annoying to use:
bindkey -s 'd^M' $'cd -\x09'
There are two problems here:
1) you need to hit enter pretty quickly.
2) there will be a slight pause after every d you type before it appears.
Actually that's a lie, you can do something up like this too
zle -N accept-line my_accept_line_wrapper
function my_accept_line_wrapper() {
if [[ $BUFFER = d ]]; then
BUFFER=
zle -U $'cd -\x09'
#doing the above sequence by putting the text in $BUFFER and calling
#zle expand-or-complete doesn't work, the cursor is in the wrong position
#setting $CURSOR to 4 doesn't seem to help, nor does zle end-of-line
else
zle .$WIDGET
fi
}
--
Mikael Magnusson
Messages sorted by:
Reverse Date,
Date,
Thread,
Author