Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: "Alt ." to repeat last part of a command
- X-seq: zsh-users 15021
- From: Peter Stephenson <pws@xxxxxxx>
- To: zsh-users@xxxxxxx
- Subject: Re: "Alt ." to repeat last part of a command
- Date: Fri, 23 Apr 2010 10:48:19 +0100
- In-reply-to: <20100423092734.GA7499@xxxxxxxxxxxxxxxxxxx>
- 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: Cambridge Silicon Radio
- References: <g2r8f67b6f81004230214j86a58e34r974261cb88ea1250@xxxxxxxxxxxxxx> <20100423092734.GA7499@xxxxxxxxxxxxxxxxxxx>
On Fri, 23 Apr 2010 11:27:35 +0200
Vincent Lefevre <vincent@xxxxxxxxxx> wrote:
> On 2010-04-23 09:14:24 +0000, Carlo Trimarchi wrote:
> > how can I use the "Alt ." combination to repeat the last part of a
> > command?
>
> I suppose you meant "Esc ." (Alt combinations don't make sense in
> a terminal, they are translated to something else, e.g. by Esc).
It depends a bit on the terminal... some turn "Alt ." into "Esc .", other pass
through "." with the 8th bit set. If the latter is happening you'd need to
use "bindkey -m" to apply the appropriate definitions, which means you
can't use non-ASCII characters from the keyboard (this consequently
produces a warning nowadays). A better option might be to investigate
whether your terminal can convert the "Alt . input" into "Esc ."
> > When I used bash I used a lot this.
> > Or, maybe, is there any other combination in zsh to do the same
> > thing?
>
> It should work in zsh:
>
> ypig% bindkey '^[.'
> "^[." insert-last-word
Unless you're in vi mode, in which case you can just bind it in the obvious
way.
bindkey -M viins '\e.' insert-last-word
This would mean there's a delay when you hit Esc to go to command mode,
because the shell needs to decide whether there's a "." next or not.
pws
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