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

Re: "Alt ." to repeat last part of a command



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