zsh-users
 help / color / mirror / code / Atom feed
* "Alt ." to repeat last part of a command
@ 2010-04-23  9:14 Carlo Trimarchi
  2010-04-23  9:24 ` Jérémie Roquet
  2010-04-23  9:27 ` Vincent Lefevre
  0 siblings, 2 replies; 12+ messages in thread
From: Carlo Trimarchi @ 2010-04-23  9:14 UTC (permalink / raw)
  To: zsh-users

Hi,
how can I use the "Alt ." combination to repeat the last part of a
command? When I used bash I used a lot this.
Or, maybe, is there any other combination in zsh to do the same thing?

Thanks,
Carlo


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: "Alt ." to repeat last part of a command
  2010-04-23  9:14 "Alt ." to repeat last part of a command Carlo Trimarchi
@ 2010-04-23  9:24 ` Jérémie Roquet
  2010-04-23  9:34   ` Jérémie Roquet
  2010-04-23  9:27 ` Vincent Lefevre
  1 sibling, 1 reply; 12+ messages in thread
From: Jérémie Roquet @ 2010-04-23  9:24 UTC (permalink / raw)
  To: Carlo Trimarchi; +Cc: zsh-users

Hello,

2010/4/23 Carlo Trimarchi <mr.spoon21@gmail.com>:
> how can I use the "Alt ." combination to repeat the last part of a
> command? When I used bash I used a lot this.
> Or, maybe, is there any other combination in zsh to do the same thing?

Not sure I understood what you mean, but maybe :

bindkey -s '^[.' '!#$'

Best regards,

-- 
Jérémie


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: "Alt ." to repeat last part of a command
  2010-04-23  9:14 "Alt ." to repeat last part of a command Carlo Trimarchi
  2010-04-23  9:24 ` Jérémie Roquet
@ 2010-04-23  9:27 ` Vincent Lefevre
  2010-04-23  9:48   ` Peter Stephenson
  2010-04-23  9:49   ` Carlo Trimarchi
  1 sibling, 2 replies; 12+ messages in thread
From: Vincent Lefevre @ 2010-04-23  9:27 UTC (permalink / raw)
  To: zsh-users

Hi,

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).

> 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

-- 
Vincent Lefèvre <vincent@vinc17.net> - Web: <http://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / Arénaire project (LIP, ENS-Lyon)


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: "Alt ." to repeat last part of a command
  2010-04-23  9:24 ` Jérémie Roquet
@ 2010-04-23  9:34   ` Jérémie Roquet
  0 siblings, 0 replies; 12+ messages in thread
From: Jérémie Roquet @ 2010-04-23  9:34 UTC (permalink / raw)
  To: Carlo Trimarchi; +Cc: zsh-users

2010/4/23 Jérémie Roquet <arkanosis@gmail.com>:
> 2010/4/23 Carlo Trimarchi <mr.spoon21@gmail.com>:
>> how can I use the "Alt ." combination to repeat the last part of a
>> command? When I used bash I used a lot this.
>> Or, maybe, is there any other combination in zsh to do the same thing?
>
> Not sure I understood what you mean, but maybe :
>
> bindkey -s '^[.' '!#$'

Or

bindkey -s '^[.' '!$'

if you want the last part of the /previous/ command

function last-arg()
{
    LBUFFER+=' !$'
    zle complete-word
}
zle -N last-arg
bindkey '^[.' last-arg

not to have to press <space> and <tab>

-- 
Jérémie


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: "Alt ." to repeat last part of a command
  2010-04-23  9:27 ` Vincent Lefevre
@ 2010-04-23  9:48   ` Peter Stephenson
  2010-04-23  9:49   ` Carlo Trimarchi
  1 sibling, 0 replies; 12+ messages in thread
From: Peter Stephenson @ 2010-04-23  9:48 UTC (permalink / raw)
  To: zsh-users

On Fri, 23 Apr 2010 11:27:35 +0200
Vincent Lefevre <vincent@vinc17.org> 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


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: "Alt ." to repeat last part of a command
  2010-04-23  9:27 ` Vincent Lefevre
  2010-04-23  9:48   ` Peter Stephenson
@ 2010-04-23  9:49   ` Carlo Trimarchi
  2010-04-23 10:27     ` Vincent Lefevre
  2010-04-23 15:34     ` James Andrewartha
  1 sibling, 2 replies; 12+ messages in thread
From: Carlo Trimarchi @ 2010-04-23  9:49 UTC (permalink / raw)
  To: zsh-users

On 23 April 2010 09:27, Vincent Lefevre <vincent@vinc17.org> wrote:
>
> I suppose you meant "Esc ." (Alt combinations don't make sense in
> a terminal, they are translated to something else, e.g. by Esc).

No, I meant "Alt ."

In bash, at the moment, I can do this:

$ ls workspace/

then I can press "cd Alt ." to show the command "cd workspace/"

In zsh it seems that "Alt ." executes "cd .." and it brings me to the
parent directory.

> It should work in zsh:
>
> ypig% bindkey '^[.'
> "^[." insert-last-word



Thanks, I'll try


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: "Alt ." to repeat last part of a command
  2010-04-23  9:49   ` Carlo Trimarchi
@ 2010-04-23 10:27     ` Vincent Lefevre
  2010-04-23 15:34     ` James Andrewartha
  1 sibling, 0 replies; 12+ messages in thread
From: Vincent Lefevre @ 2010-04-23 10:27 UTC (permalink / raw)
  To: zsh-users

On 2010-04-23 09:49:53 +0000, Carlo Trimarchi wrote:
> On 23 April 2010 09:27, Vincent Lefevre <vincent@vinc17.org> wrote:
> >
> > I suppose you meant "Esc ." (Alt combinations don't make sense in
> > a terminal, they are translated to something else, e.g. by Esc).
> 
> No, I meant "Alt ."

This is what you type. But for the shell, there's no such thing.
You need to know what your terminal does with "Alt .".

-- 
Vincent Lefèvre <vincent@vinc17.net> - Web: <http://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / Arénaire project (LIP, ENS-Lyon)


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: "Alt ." to repeat last part of a command
  2010-04-23  9:49   ` Carlo Trimarchi
  2010-04-23 10:27     ` Vincent Lefevre
@ 2010-04-23 15:34     ` James Andrewartha
  2010-04-23 16:10       ` Carlo Trimarchi
  1 sibling, 1 reply; 12+ messages in thread
From: James Andrewartha @ 2010-04-23 15:34 UTC (permalink / raw)
  To: Carlo Trimarchi; +Cc: zsh-users

On 23 April 2010 17:49, Carlo Trimarchi <mr.spoon21@gmail.com> wrote:
> On 23 April 2010 09:27, Vincent Lefevre <vincent@vinc17.org> wrote:
>>
>> I suppose you meant "Esc ." (Alt combinations don't make sense in
>> a terminal, they are translated to something else, e.g. by Esc).
>
> No, I meant "Alt ."
>
> In bash, at the moment, I can do this:
>
> $ ls workspace/
>
> then I can press "cd Alt ." to show the command "cd workspace/"
>
> In zsh it seems that "Alt ." executes "cd .." and it brings me to the
> parent directory.

When you run 'zsh -f', does 'Alt .' work? If not, what about after
running 'bindkey -e'? Do you have EDITOR set?

James Andrewartha


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: "Alt ." to repeat last part of a command
  2010-04-23 15:34     ` James Andrewartha
@ 2010-04-23 16:10       ` Carlo Trimarchi
  2010-04-23 19:48         ` Peter Stephenson
  0 siblings, 1 reply; 12+ messages in thread
From: Carlo Trimarchi @ 2010-04-23 16:10 UTC (permalink / raw)
  To: trs80; +Cc: zsh-users

On 23 April 2010 15:34, James Andrewartha <trs80@student.uwa.edu.au> wrote:
> When you run 'zsh -f', does 'Alt .' work?

No, it doesn't.

>If not, what about after running 'bindkey -e'?

Yes, it works like I want. I mean, it repeats the last part of a command.

> Do you have EDITOR set?

I think it is set to vim:

lloyd% echo $EDITOR
vim


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: "Alt ." to repeat last part of a command
  2010-04-23 16:10       ` Carlo Trimarchi
@ 2010-04-23 19:48         ` Peter Stephenson
  2010-04-25 12:09           ` Carlo Trimarchi
  0 siblings, 1 reply; 12+ messages in thread
From: Peter Stephenson @ 2010-04-23 19:48 UTC (permalink / raw)
  To: zsh-users

On Fri, 23 Apr 2010 16:10:23 +0000
Carlo Trimarchi <mr.spoon21@gmail.com> wrote:
> On 23 April 2010 15:34, James Andrewartha <trs80@student.uwa.edu.au> wrote:
> > When you run 'zsh -f', does 'Alt .' work?
> 
> No, it doesn't.
> 
> >If not, what about after running 'bindkey -e'?
> 
> Yes, it works like I want. I mean, it repeats the last part of a command.
> 
> > Do you have EDITOR set?
> 
> I think it is set to vim:
> 
> lloyd% echo $EDITOR
> vim

so this bit of my previous message is what you need...


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.

-- 
Peter Stephenson <p.w.stephenson@ntlworld.com>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: "Alt ." to repeat last part of a command
  2010-04-23 19:48         ` Peter Stephenson
@ 2010-04-25 12:09           ` Carlo Trimarchi
  2010-04-25 12:46             ` Mikael Magnusson
  0 siblings, 1 reply; 12+ messages in thread
From: Carlo Trimarchi @ 2010-04-25 12:09 UTC (permalink / raw)
  To: Peter Stephenson; +Cc: zsh-users

On 23 April 2010 19:48, Peter Stephenson <p.w.stephenson@ntlworld.com> wrote:
>
> so this bit of my previous message is what you need...
>
> 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

I see, thanks. I think I have to read something about this in the documentation.


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: "Alt ." to repeat last part of a command
  2010-04-25 12:09           ` Carlo Trimarchi
@ 2010-04-25 12:46             ` Mikael Magnusson
  0 siblings, 0 replies; 12+ messages in thread
From: Mikael Magnusson @ 2010-04-25 12:46 UTC (permalink / raw)
  To: Carlo Trimarchi; +Cc: zsh-users

On 25 April 2010 14:09, Carlo Trimarchi <mr.spoon21@gmail.com> wrote:
> On 23 April 2010 19:48, Peter Stephenson <p.w.stephenson@ntlworld.com> wrote:
>>
>> so this bit of my previous message is what you need...
>>
>> 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
>
> I see, thanks. I think I have to read something about this in the documentation.

Unless you particularly want to use vi mode, you probably just want to
put "bindkey -e" early in your .zshrc (early meaning before other
bindkey commands).

-- 
Mikael Magnusson


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2010-04-25 12:46 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-04-23  9:14 "Alt ." to repeat last part of a command Carlo Trimarchi
2010-04-23  9:24 ` Jérémie Roquet
2010-04-23  9:34   ` Jérémie Roquet
2010-04-23  9:27 ` Vincent Lefevre
2010-04-23  9:48   ` Peter Stephenson
2010-04-23  9:49   ` Carlo Trimarchi
2010-04-23 10:27     ` Vincent Lefevre
2010-04-23 15:34     ` James Andrewartha
2010-04-23 16:10       ` Carlo Trimarchi
2010-04-23 19:48         ` Peter Stephenson
2010-04-25 12:09           ` Carlo Trimarchi
2010-04-25 12:46             ` Mikael Magnusson

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).