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