Article View: comp.editors
Article #3295re: Case Reversing Macro for vi
From: Ewbank
Date: Fri, 09 Sep 1988 19:04
Date: Fri, 09 Sep 1988 19:04
38 lines
1985 bytes
1985 bytes
Hi Again -- Several people have provided corrections to my case conversion macro. In order that a correct version be available, I am reposting with the corrected version of the macros. They are: ---------------------------------------- map ^C : ^W -- reverse the case of the current word map ^C : ^T -- reverse the case of the current line. map ^C : a more elegant definition for ^T is map ^C : !!tr '[a-z][A-Z]' '[A-Z][a-z]'^M map ^C : but this trashes the screen display near the map ^C : end of the file in some cases :-(. map ^T 0y$Pa^M^[-:s/./\~/g^M"0zy$dd@z map ^W lBi^M^[Ea^M^[-I ^[^d0^T-3J ---------------------------------------- Before :so'ing the above, convert the following characters: ^ C ==> <cntl> C [or these lines can be discarded] ^ M ==> <cntl> M ^ T ==> <cntl> T ^ W ==> <cntl> W ^ [ ==> <esc> NOTE: ^d **really** is a carat (^) followed by a lowercase d. The ^W macro will reverse the case of the current word (the word that contains the cursor). The ^T macro will reverse the case of the current line. Thanks to all of the people who sent me suggestions and bug reports. I hope that these two macros work better. The alternate definition of the ^T macro [using tr(1)] causes vi to get confused when the operation is done in the first line of a file that is less than about 20 lines long. The contents of the file is correctly translated, but the screen is corrupted with duplicate copies of the last few lines of the file. -- Bryan Ewbank, AT&T Bell Labs, bdewbank@ihlpb.ATT.COM === the opinions included herein are mine, not my employer's ===
Technical Details
Message-ID:
<8700@ihlpb.ATT.COM>Path:
arc1-ca.pugleaf.net!utzoo!attcan!uunet!husc6!rutgers!tut.cis.ohio-state.edu!osu-cis!att!ihlpb!bdewbankShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!husc6!rutgers!tut.cis.ohio-state.edu!osu-cis!att!ihlpb!bdewbank From: bdewbank@ihlpb.ATT.COM (Ewbank) Newsgroups: comp.editors Subject: re: Case Reversing Macro for vi Keywords: correction Message-ID: <8700@ihlpb.ATT.COM> Date: 9 Sep 88 19:04:48 GMT Organization: AT&T Bell Laboratories - Naperville, Illinois Lines: 38