* Refereing to elements in current command line
@ 2006-09-08 10:12 zzapper
2006-09-08 11:07 ` Frank Terbeck
2006-09-08 16:22 ` Drew Perttula
0 siblings, 2 replies; 4+ messages in thread
From: zzapper @ 2006-09-08 10:12 UTC (permalink / raw)
To: zsh-users
Hi
Sorry if this is an old chestnut
I often type somethig like
> cp fredjoesid.php danjoesid.php
At Present I use i a binding Control-O to do
> cp fredjoesid.php fredjoesid.php
end then vi edit
But how else can I do this?
--
http://successtheory.com/tips/ Vim, Zsh, MySQL Tips
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Refereing to elements in current command line
2006-09-08 10:12 Refereing to elements in current command line zzapper
@ 2006-09-08 11:07 ` Frank Terbeck
2006-09-08 16:22 ` Drew Perttula
1 sibling, 0 replies; 4+ messages in thread
From: Frank Terbeck @ 2006-09-08 11:07 UTC (permalink / raw)
To: zsh-users
zzapper <david@tvis.co.uk>:
> Sorry if this is an old chestnut
> I often type somethig like
>
> > cp fredjoesid.php danjoesid.php
>
> At Present I use i a binding Control-O to do
>
> > cp fredjoesid.php fredjoesid.php
>
> end then vi edit
> But how else can I do this?
Sounds like a job for history-expansion:
[snip]
zsh% touch fredjoesid.php
zsh% cp fredjoesid.php danjoesid.php
zsh% !:0-1 !:1:s^fred^donny
cp fredjoesid.php donnyjoesid.php
zsh% print -l *.php
danjoesid.php
donnyjoesid.php
fredjoesid.php
[snap]
See 'man 1 zshexpn' /HISTORY EXPANSION for details.
Regards, Frank
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Refereing to elements in current command line
2006-09-08 10:12 Refereing to elements in current command line zzapper
2006-09-08 11:07 ` Frank Terbeck
@ 2006-09-08 16:22 ` Drew Perttula
2006-09-08 17:05 ` zzapper
1 sibling, 1 reply; 4+ messages in thread
From: Drew Perttula @ 2006-09-08 16:22 UTC (permalink / raw)
To: zsh-users
zzapper wrote:
> Hi
> Sorry if this is an old chestnut
>
> I often type somethig like
>
>> cp fredjoesid.php danjoesid.php
>
> At Present I use i a binding Control-O to do
>
>> cp fredjoesid.php fredjoesid.php
> end then vi edit
>
> But how else can I do this?
>
>
perhaps with !#
cp fredjoesid.php !#$:s/fred/dan
then tab to check that the last argument expands the way you want
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Refereing to elements in current command line
2006-09-08 16:22 ` Drew Perttula
@ 2006-09-08 17:05 ` zzapper
0 siblings, 0 replies; 4+ messages in thread
From: zzapper @ 2006-09-08 17:05 UTC (permalink / raw)
To: zsh-users
Drew Perttula <drewp@bigasterisk.com> wrote in news:450198AD.1070104
@bigasterisk.com:
>
> cp fredjoesid.php !#$:s/fred/dan
>
> then tab to check that the last argument expands the way you want
>
Drew,
Yep that's what I was looking for
Summary AFAICT
For CURRENT line (the # designates current line)
!#:0 command
!#^ first parameter
!#:1 first parameter
!#:1-4 first 4 parameters
!#$ last parameter
!#* all parameters
!#$:s/bash/zsh
For Previous Command (for comparison)
!! repeat
!:0 command
!^ first parameter
!:1 first parameter
!:1-4 first 4 parameters
!$ last parameter
!* all parameters
!!:s/bash/zsh
For last but one command
!-2:2 second parameter of second but last command
--
http://successtheory.com/tips/ Vim, Zsh, MySQL Tips
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2006-09-08 17:23 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-09-08 10:12 Refereing to elements in current command line zzapper
2006-09-08 11:07 ` Frank Terbeck
2006-09-08 16:22 ` Drew Perttula
2006-09-08 17:05 ` 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).