Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Accidently wrote a command in CAPS LOCK
- X-seq: zsh-users 10409
- From: zzapper <david@xxxxxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: Re: Accidently wrote a command in CAPS LOCK
- Date: Thu, 22 Jun 2006 10:36:10 +0000 (UTC)
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- Organization: SuccessTheory
- References: <Xns97EA6E7D249FAzzappergmailcom@xxxxxxxxxxx> <200606221025.k5MAPD8f010975@xxxxxxxxxxxxxx>
- Sender: news <news@xxxxxxxxxxxxx>
Peter Stephenson <pws@xxxxxxx> wrote in
news:200606221025.k5MAPD8f010975@xxxxxxxxxxxxxx:
> zzapper wrote:
>>
>> Accidently wrote a command in CAPS LOCK
>>
>> FTX SUCC BOOK
>>
>> What's the best way to lowercase this?
>
> Well, going to the start and using down-case-word (ESC l in Emacs
> mode) until you get to the end is the obvious way.
>
> But it's not hard (after you've worked out the offsets, anyway) to
> write a widget that transforms the region---I hadn't realised there
> wasn't one:
>
> down-case-region() {
> emulate -L zsh
> integer p1 p2
>
> if (( CURSOR < MARK )); then
> (( p1=CURSOR+1, p2=MARK ))
> else
> (( p1=MARK+1, p2=CURSOR ))
> fi
> BUFFER[p1,p2]=${(L)BUFFER[p1,p2]}
> }
> zle -N down-case-region
>
> Unfortunately ${(L)...} and parameter indexing don't handle multibyte
> characters yet, so down-case-word, which is implemented internally,
> should be safer. You could use some kind of hybrid.
>
I was hoping for a history modifier eg
^^^ or !!:s///
but they don't seem to support wildcards?
--
http://successtheory.com/tips/ Vim, Zsh, MySQL Tips
Messages sorted by:
Reverse Date,
Date,
Thread,
Author