zsh-users
 help / color / mirror / code / Atom feed
* Substitution
@ 2005-04-17 13:02 Saket Sathe
  2005-04-17 13:07 ` Substitution Eric Mangold
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Saket Sathe @ 2005-04-17 13:02 UTC (permalink / raw)
  To: zsh-users

Hi,
Suppose I've typed these commands:

# mv somefile1 /home/saket/stuff/books/
# acroread somefile.pdf
# mv somefile2 /home/saket/stuff/books/

How can I substitute the '/home/saket/stuff/books/' of the first command 
into the last command ?
Currently I just retype it again :(

-- 
Saket.


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

* Re: Substitution
  2005-04-17 13:02 Substitution Saket Sathe
@ 2005-04-17 13:07 ` Eric Mangold
  2005-04-17 13:12   ` Substitution Saket Sathe
  2005-04-17 13:09 ` Substitution Alexey Tourbin
  2005-04-18 10:31 ` Substitution zzapper
  2 siblings, 1 reply; 7+ messages in thread
From: Eric Mangold @ 2005-04-17 13:07 UTC (permalink / raw)
  To: Saket Sathe, zsh-users

On Sun, 17 Apr 2005 18:32:56 +0530, Saket Sathe <saket@cc.iitb.ac.in>  
wrote:

> Hi,
> Suppose I've typed these commands:
>
> # mv somefile1 /home/saket/stuff/books/
> # acroread somefile.pdf
> # mv somefile2 /home/saket/stuff/books/
>
> How can I substitute the '/home/saket/stuff/books/' of the first command  
> into the last command ?
> Currently I just retype it again :(

I would push M-. twice. Assuming you have emacs bindings set as in  
"bindkey -e"

-Eric



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

* Re: Substitution
  2005-04-17 13:02 Substitution Saket Sathe
  2005-04-17 13:07 ` Substitution Eric Mangold
@ 2005-04-17 13:09 ` Alexey Tourbin
  2005-04-18 10:31 ` Substitution zzapper
  2 siblings, 0 replies; 7+ messages in thread
From: Alexey Tourbin @ 2005-04-17 13:09 UTC (permalink / raw)
  To: zsh-users

[-- Attachment #1: Type: text/plain, Size: 233 bytes --]

On Sun, Apr 17, 2005 at 06:32:56PM +0530, Saket Sathe wrote:
> How can I substitute the '/home/saket/stuff/books/' of the first command 
> into the last command ?
> Currently I just retype it again :(

ESC .

> -- 
> Saket.

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

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

* Re: Substitution
  2005-04-17 13:07 ` Substitution Eric Mangold
@ 2005-04-17 13:12   ` Saket Sathe
  2005-04-17 13:18     ` Substitution Eric Mangold
  0 siblings, 1 reply; 7+ messages in thread
From: Saket Sathe @ 2005-04-17 13:12 UTC (permalink / raw)
  To: Eric Mangold; +Cc: zsh-users

Eric Mangold wrote:

> On Sun, 17 Apr 2005 18:32:56 +0530, Saket Sathe <saket@cc.iitb.ac.in>  
> wrote:
>
>> Hi,
>> Suppose I've typed these commands:
>>
>> # mv somefile1 /home/saket/stuff/books/
>> # acroread somefile.pdf
>> # mv somefile2 /home/saket/stuff/books/
>>
>> How can I substitute the '/home/saket/stuff/books/' of the first 
>> command  into the last command ?
>> Currently I just retype it again :(
>
>
> I would push M-. twice. Assuming you have emacs bindings set as in  
> "bindkey -e"
>
> -Eric

Can '!:n' or something similar be used ? Or is '!:n' used only if you 
want arguments from the _last_ command.

-- 
Saket.

... The gene pool sure could use a little chlorine.


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

* Re: Substitution
  2005-04-17 13:12   ` Substitution Saket Sathe
@ 2005-04-17 13:18     ` Eric Mangold
  2005-04-17 13:27       ` Substitution Saket Sathe
  0 siblings, 1 reply; 7+ messages in thread
From: Eric Mangold @ 2005-04-17 13:18 UTC (permalink / raw)
  To: Saket Sathe; +Cc: zsh-users

On Sun, 17 Apr 2005 18:42:31 +0530, Saket Sathe <saket@cc.iitb.ac.in>  
wrote:

> Eric Mangold wrote:
>
>> On Sun, 17 Apr 2005 18:32:56 +0530, Saket Sathe <saket@cc.iitb.ac.in>   
>> wrote:
>>
>>> Hi,
>>> Suppose I've typed these commands:
>>>
>>> # mv somefile1 /home/saket/stuff/books/
>>> # acroread somefile.pdf
>>> # mv somefile2 /home/saket/stuff/books/
>>>
>>> How can I substitute the '/home/saket/stuff/books/' of the first  
>>> command  into the last command ?
>>> Currently I just retype it again :(
>>
>>
>> I would push M-. twice. Assuming you have emacs bindings set as in   
>> "bindkey -e"
>>
>> -Eric
>
> Can '!:n' or something similar be used ? Or is '!:n' used only if you  
> want arguments from the _last_ command.

That'll all be documented here:  
http://zsh.sunsite.dk/Doc/Release/zsh_13.html#SEC48

-Eric


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

* Re: Substitution
  2005-04-17 13:18     ` Substitution Eric Mangold
@ 2005-04-17 13:27       ` Saket Sathe
  0 siblings, 0 replies; 7+ messages in thread
From: Saket Sathe @ 2005-04-17 13:27 UTC (permalink / raw)
  To: Eric Mangold; +Cc: zsh-users

Eric Mangold wrote:

> On Sun, 17 Apr 2005 18:42:31 +0530, Saket Sathe <saket@cc.iitb.ac.in>  
> wrote:
>
>> Eric Mangold wrote:
>>
>>> On Sun, 17 Apr 2005 18:32:56 +0530, Saket Sathe 
>>> <saket@cc.iitb.ac.in>   wrote:
>>>
>>>> Hi,
>>>> Suppose I've typed these commands:
>>>>
>>>> # mv somefile1 /home/saket/stuff/books/
>>>> # acroread somefile.pdf
>>>> # mv somefile2 /home/saket/stuff/books/
>>>>
>>>> How can I substitute the '/home/saket/stuff/books/' of the first  
>>>> command  into the last command ?
>>>> Currently I just retype it again :(
>>>
>>>
>>>
>>> I would push M-. twice. Assuming you have emacs bindings set as in   
>>> "bindkey -e"
>>>
>>> -Eric
>>
>>
>> Can '!:n' or something similar be used ? Or is '!:n' used only if 
>> you  want arguments from the _last_ command.
>
>
> That'll all be documented here:  
> http://zsh.sunsite.dk/Doc/Release/zsh_13.html#SEC48
>
> -Eric

Thanks :) got it..

-- 
Saket.

... It is better to be violent, if there is violence in our hearts, than 
to put on the cloak of nonviolence to cover impotence. -  Mahatma Gandhi


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

* Re: Substitution
  2005-04-17 13:02 Substitution Saket Sathe
  2005-04-17 13:07 ` Substitution Eric Mangold
  2005-04-17 13:09 ` Substitution Alexey Tourbin
@ 2005-04-18 10:31 ` zzapper
  2 siblings, 0 replies; 7+ messages in thread
From: zzapper @ 2005-04-18 10:31 UTC (permalink / raw)
  To: zsh-users

On Sun, 17 Apr 2005 18:32:56 +0530,  wrote:

>Hi,
>Suppose I've typed these commands:
>
># mv somefile1 /home/saket/stuff/books/
># acroread somefile.pdf
># mv somefile2 /home/saket/stuff/books/
>
>How can I substitute the '/home/saket/stuff/books/' of the first command 
>into the last command ?
>Currently I just retype it again :(

We all want this but you have eat a little bit if syntax pie!

Scrolling back in history (ESC) (Uparrow) and then reditting that line is the perhaps the easiest
way.
However

> mv !?saket<TAB>
Would bring up the whole line ready for a little editting

or purist

> mv !?saket?:*<tab>
Would just bring up the parameters

If you know the history number of the line (say 5) with desired parameters you can try

> !5:s/somefile1/somefile2/

and if you don't know the history number

!?saket?:s/somefile1/somefile2/

Have I missed anything? (I surely have!)



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

end of thread, other threads:[~2005-04-18 10:32 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-04-17 13:02 Substitution Saket Sathe
2005-04-17 13:07 ` Substitution Eric Mangold
2005-04-17 13:12   ` Substitution Saket Sathe
2005-04-17 13:18     ` Substitution Eric Mangold
2005-04-17 13:27       ` Substitution Saket Sathe
2005-04-17 13:09 ` Substitution Alexey Tourbin
2005-04-18 10:31 ` Substitution zzapper

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