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

Re: Very useful !#^

I usually use brace expansion for this, it's a bit easier to remember

ie: cp reallybigfilename{,-backup}

it expands to: cp reallybigfilename reallybigfilename-backup, if you have certain settings set you can also just tab and it will expand it for you.

Don't forget the comma right after the brace. You can also change extension by:

 mv textfile.{txt,bak}   -> expands to mv textfile.txt textfile.bak

On 8/3/07, Tim <piglet@xxxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
zzapper <david@xxxxxxxxxx> writes:

> Hi
> cos I keep forgetting this myself
>> cp verylongfilename.tex   backup_!#^<tab>
> expands to
>> cp verylongfilename.tex backup_verylongfilename.tex

Oh, excellent. I've been wondering for ages if there's such a thing and
never got around to hunting it.

A related joy: !$ tab-expands to last word of previous line. Notably this
has a corresponding keypress, M-. or M-_  Is there a key for !#^ as well?


Messages sorted by: Reverse Date, Date, Thread, Author