home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / unix / question / 14636 < prev    next >
Encoding:
Internet Message Format  |  1992-12-12  |  1.4 KB

  1. Path: sparky!uunet!zaphod.mps.ohio-state.edu!cs.utexas.edu!asuvax!chnews!sedona!bhoughto
  2. From: bhoughto@sedona.intel.com (Blair P. Houghton)
  3. Newsgroups: comp.unix.questions
  4. Subject: Re: how do you center a line in vi/ex ???
  5. Date: 12 Dec 1992 22:55:16 GMT
  6. Organization: Intel Corp., Chandler, Arizona
  7. Lines: 23
  8. Message-ID: <1gdqkkINNg0e@chnews.intel.com>
  9. References: <fish.724035067@news2.gsfc.nasa.gov> <1992Dec11.040216.14337@umbc3.umbc.edu>
  10. NNTP-Posting-Host: stealth.intel.com
  11.  
  12. In article <1992Dec11.040216.14337@umbc3.umbc.edu> rouben@math9.math.umbc.edu (Rouben Rostamian) writes:
  13. >map v :s/^[     ]*//^M:s/[     ]*$//^M$ma81a 81^V|D`alxd0:s/  / /g^M$p
  14.                                              ^^
  15. Forgot the ESC to end the append mode:
  16.  
  17.   map v :s/^[     ]*//^M:s/[     ]*$//^M$ma81a ^[81^V|D`alxd0:s/  / /g^M$p
  18.  
  19. This one has the added feature of not moving the cursor (rather,
  20. of returning it to its original row and column):
  21.  
  22.   map ^K mm:s/^[  ]*//^M:s/[  ]*$//^M$mn61a ^[61^V|D`nlxd0:s/  / /g^M$p`m
  23.  
  24. It also centers on the first 60 columns, since that's my
  25. typical line length.
  26.  
  27. And be careful not to use these macros on any line that has
  28. 81 (61) or more characters between the leading and trailing
  29. whitespace.  If the line is more than 80 (60) significant
  30. chars long, only the first 80 (60) will be retained, and
  31. the trailing characters will be elided.
  32.  
  33.                 --Blair
  34.                   "Nothing to worry abo
  35.