[comp.unix.questions] vi case-change question

rich@gtx.com (Rich Holloway) (07/01/89)

In vi, I would like to use the '~' operation on more than one character
at a time, but don't really want to take on the overhead of shelling out
to "tr" or somesuch.  To wit, what I would like is a way to convert
upper to lower from the cursor to the end of line.  For example,

	FOOBAR	 DS.L 3 	TABLE OF THREE FOO LONG WORDS

I'd like to be able to put the cursor at the beginning of "TABLE", enter
some non-shell-escape command (if possible) and get the line:

	FOOBAR	 DS.L 3 	table of three foo long words

Any ideas?

Comments such as "get a REAL editor" and "use emacs instead" will be met
with rotten tomatoes, as these are not options.

E-mailed responses welcome, I'll summarize if there's interest.

Merci d'avance,
  rich

-- 
Richard L. Holloway	...!sun!sunburn!gtx!rich      
GTX Corporation,        Phoenix, Arizona  

irf@kuling.UUCP (Bo Thide') (07/02/89)

In article <1055@gtx.com> rich@gtx.com (Rich Holloway) writes:
>
>In vi, I would like to use the '~' operation on more than one character
>at a time, but don't really want to take on the overhead of shelling out
>to "tr" or somesuch.  To wit, what I would like is a way to convert
> [deleted]

There are alternatives to using '~' in vi:

  :s/<pattern>/\U&   will change <pattern> to upper case
  :s/<pattern>/\L&   will change <pattern> to lower case

Quite useful sometimes.  Perhaps for you too?/


   ^   Bo Thide'--------------------------------------------------------------
  | |       Swedish Institute of Space Physics, S-755 91 Uppsala, Sweden
  |I|    [In Swedish: Institutet f|r RymdFysik, Uppsalaavdelningen (IRFU)]
  |R|  Phone: (+46) 18-403000.  Telex: 76036 (IRFUPP S).  Fax: (+46) 18-403100 
 /|F|\        INTERNET: bt@irfu.se       UUCP: ...!uunet!sunic!irfu!bt
 ~~U~~ -----------------------------------------------------------------sm5dfw

wk@hpirs.HP.COM (Wayne Krone) (07/06/89)

> In vi, I would like to use the '~' operation on more than one character

In addition to Bo's suggestions, HP-UX vi for releases s800 3.0 and
s300 6.5 or later has been modified to accept a count before the "~"
operator.  So for your example the command "99~" would do what you
want.

Wayne