home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!dtix!darwin.sura.net!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 ???
- Message-ID: <1giql2INNn58@chnews.intel.com>
- Date: 14 Dec 92 20:26:10 GMT
- References: <fish.724035067@news2.gsfc.nasa.gov> <1992Dec11.040216.14337@umbc3.umbc.edu> <1992Dec14.054911.9921@news.mentorg.com>
- Organization: Intel Corp., Chandler, Arizona
- Lines: 58
- NNTP-Posting-Host: alfalfa.intel.com
-
- In article <1992Dec14.054911.9921@news.mentorg.com> thiam-chye_sim@mentorg.com writes:
- >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
- >
- >I added the statement to my .exrc file, but it does not do its job.
- >There was a message flash across the screen when I invoke, how can I view
- >that message. Is it log somewhere or how can I get the screen to freeze?
-
- It's not logged and the screen won't freeze unless you
- have XON/XOFF (^Q/^S) or something.
-
- Two things may be happening.
-
- 1. You didn't add the escape character that was missing:
-
- map v :s/^[ ]*//^M:s/[ ]*$//^M$ma81a ^[81^V|D`alxd0:s/ / /g^M$p
- --
-
- 2. You copied the string exactly. This is bad because
- several of the characters you see are actually supposed to
- be control characters. It's not encoded as control characters
- in the news posting because news has a tendency to munge
- control characters. An X11 yank-n-stuff action (select and
- copy with the mouse via the X cut-buffer) would translate a
- control character to an upcaret and a character, since
- that's what is actually on your screen (that is, it's your
- terminal that does the translation when it displays, not
- the mouse when it copies).
-
- The ones that are control characters are underlined below.
-
- map v :s/^[ ]*//^M:s/[ ]*$//^M$ma81a ^[81^V|D`alxd0:s/ / /g^M$p
- **bt..t -- bt...t -- -- -- bb b --
-
- You can enter them by typing a ctrl-V (^V) and then ctrl-M (^M),
- or ESC (^[), or ctrl-V (^V) again.
-
- The sequence marked "**" above is not a control character, it's
- an upcaret and a left square bracket.
-
- Each space character is marked with "b", and each (expanded)
- tab character is marked with "t..t" The news doesn't mess up
- tabs, but yank-n-stuff does translate them into spaces. The
- listing given when you type ":map" in vi shows them as "^I".
-
-
- Basically, you can't just edit what you see in the news to
- make vi macros. You have to figure out what you're looking
- at and make sure to use real control characters in the
- right places.
-
- --Blair
- "map V o^I^I^I^I--Blair^M ""
-
- P.S. I'm not going to be so crass as to suggest that this
- sub-notation {--,**,b,t..t} be adopted as a standard.
- Posters should just be clear about what they mean when they
- post control sequences.
-