zsh-users
 help / color / mirror / code / Atom feed
* Re: Accidently wrote a command in CAPS LOCK
@ 2006-06-22 10:40 Artur Penttinen
  0 siblings, 0 replies; 7+ messages in thread
From: Artur Penttinen @ 2006-06-22 10:40 UTC (permalink / raw)
  To: david; +Cc: zsh-users

22.06.06, 13:51, zzapper <david@tvis.co.uk>:

> 
> Accidently wrote a command in CAPS LOCK
> 
> FTX SUCC BOOK
> 
> What's the best way to lowercase this?

  \C-a \C-l \C-l ... ?
  
-- 
wbw, artur


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

* Re: Accidently wrote a command in CAPS LOCK
  2006-06-22 10:59       ` zzapper
@ 2006-06-22 11:06         ` zzapper
  0 siblings, 0 replies; 7+ messages in thread
From: zzapper @ 2006-06-22 11:06 UTC (permalink / raw)
  To: zsh-users; +Cc: zsh-workers

zzapper <david@tvis.co.uk> wrote in news:Xns97EA7A0A8EA8Azzappergmailcom@
80.91.229.5:

>  
>> You should have said that earlier...
>> 
>> !!:l
>> 
> Drat !!
> 
!!:-:l !!:$

Or just lowercase the command 
!!:0:l !*


-- 
http://successtheory.com/tips/ Vim, Zsh, MySQL Tips


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

* Re: Accidently wrote a command in CAPS LOCK
  2006-06-22 10:44     ` Peter Stephenson
@ 2006-06-22 10:59       ` zzapper
  2006-06-22 11:06         ` zzapper
  0 siblings, 1 reply; 7+ messages in thread
From: zzapper @ 2006-06-22 10:59 UTC (permalink / raw)
  To: zsh-users

 
> You should have said that earlier...
> 
> !!:l
> 
Drat !!

-- 
http://successtheory.com/tips/ Vim, Zsh, MySQL Tips


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

* Re: Accidently wrote a command in CAPS LOCK
  2006-06-22 10:36   ` zzapper
@ 2006-06-22 10:44     ` Peter Stephenson
  2006-06-22 10:59       ` zzapper
  0 siblings, 1 reply; 7+ messages in thread
From: Peter Stephenson @ 2006-06-22 10:44 UTC (permalink / raw)
  To: Zsh users list

zzapper wrote:
> I was hoping for a history modifier eg
> ^^^ or !!:s///
> but they don't seem to support wildcards?

You should have said that earlier...

!!:l

will turn the whole previous line into lower case.  Do you only want a
certain range of words?  You can do tricks like:

% ECHO THIS NEXT WORD IS UPPERCASE
zsh: command not found: ECHO
% !!:-:l !!:$
% echo this next word is UPPERCASE

The word selector - is short for 1- which is short for 1 to the word
before the last.  The word selector $ is the last word.  So you get all
but the last word in lower case, then the next word as it was.

-- 
Peter Stephenson <pws@csr.com>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070


To access the latest news from CSR copy this link into a web browser:  http://www.csr.com/email_sig.php


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

* Re: Accidently wrote a command in CAPS LOCK
  2006-06-22 10:25 ` Peter Stephenson
@ 2006-06-22 10:36   ` zzapper
  2006-06-22 10:44     ` Peter Stephenson
  0 siblings, 1 reply; 7+ messages in thread
From: zzapper @ 2006-06-22 10:36 UTC (permalink / raw)
  To: zsh-users

Peter Stephenson <pws@csr.com> wrote in
news:200606221025.k5MAPD8f010975@news01.csr.com: 

> 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


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

* Re: Accidently wrote a command in CAPS LOCK
  2006-06-22  9:51 zzapper
@ 2006-06-22 10:25 ` Peter Stephenson
  2006-06-22 10:36   ` zzapper
  0 siblings, 1 reply; 7+ messages in thread
From: Peter Stephenson @ 2006-06-22 10:25 UTC (permalink / raw)
  To: zsh-users

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.

-- 
Peter Stephenson <pws@csr.com>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070


To access the latest news from CSR copy this link into a web browser:  http://www.csr.com/email_sig.php


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

* Accidently wrote a command in CAPS LOCK
@ 2006-06-22  9:51 zzapper
  2006-06-22 10:25 ` Peter Stephenson
  0 siblings, 1 reply; 7+ messages in thread
From: zzapper @ 2006-06-22  9:51 UTC (permalink / raw)
  To: zsh-users


Accidently wrote a command in CAPS LOCK

FTX SUCC BOOK

What's the best way to lowercase this?

-- 
http://successtheory.com/tips/ Vim, Zsh, MySQL Tips


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

end of thread, other threads:[~2006-06-22 11:10 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-06-22 10:40 Accidently wrote a command in CAPS LOCK Artur Penttinen
  -- strict thread matches above, loose matches on Subject: below --
2006-06-22  9:51 zzapper
2006-06-22 10:25 ` Peter Stephenson
2006-06-22 10:36   ` zzapper
2006-06-22 10:44     ` Peter Stephenson
2006-06-22 10:59       ` zzapper
2006-06-22 11:06         ` 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).