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

  1. Path: sparky!uunet!dtix!darwin.sura.net!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. Message-ID: <1giql2INNn58@chnews.intel.com>
  6. Date: 14 Dec 92 20:26:10 GMT
  7. References: <fish.724035067@news2.gsfc.nasa.gov> <1992Dec11.040216.14337@umbc3.umbc.edu> <1992Dec14.054911.9921@news.mentorg.com>
  8. Organization: Intel Corp., Chandler, Arizona
  9. Lines: 58
  10. NNTP-Posting-Host: alfalfa.intel.com
  11.  
  12. In article <1992Dec14.054911.9921@news.mentorg.com> thiam-chye_sim@mentorg.com writes:
  13. >In article <1992Dec11.040216.14337@umbc3.umbc.edu>, rouben@math9.math.umbc.edu (Rouben Rostamian) writes:
  14. >|> map v :s/^[     ]*//^M:s/[     ]*$//^M$ma81a 81^V|D`alxd0:s/  / /g^M$p
  15. >
  16. >I added the statement to my .exrc file, but it does not do its job.
  17. >There was a message flash across the screen when I invoke, how can I view
  18. >that message. Is it log somewhere or how can I get the screen to freeze?
  19.  
  20. It's not logged and the screen won't freeze unless you
  21. have XON/XOFF (^Q/^S) or something.
  22.  
  23. Two things may be happening.
  24.  
  25. 1.  You didn't add the escape character that was missing:
  26.  
  27.   map v :s/^[     ]*//^M:s/[      ]*$//^M$ma81a ^[81^V|D`alxd0:s/  / /g^M$p
  28.                                               --
  29.  
  30. 2.  You copied the string exactly.  This is bad because
  31. several of the characters you see are actually supposed to
  32. be control characters.  It's not encoded as control characters
  33. in the news posting because news has a tendency to munge
  34. control characters.  An X11 yank-n-stuff action (select and
  35. copy with the mouse via the X cut-buffer) would translate a
  36. control character to an upcaret and a character, since
  37. that's what is actually on your screen (that is, it's your
  38. terminal that does the translation when it displays, not
  39. the mouse when it copies).
  40.  
  41. The ones that are control characters are underlined below.
  42.  
  43.   map v :s/^[     ]*//^M:s/[      ]*$//^M$ma81a ^[81^V|D`alxd0:s/  / /g^M$p
  44.            **bt..t    --    bt...t     --       --  --           bb b  --
  45.  
  46. You can enter them by typing a ctrl-V (^V) and then ctrl-M (^M),
  47. or ESC (^[), or ctrl-V (^V) again.
  48.  
  49. The sequence marked "**" above is not a control character, it's
  50. an upcaret and a left square bracket.
  51.  
  52. Each space character is marked with "b", and each (expanded)
  53. tab character is marked with "t..t"  The news doesn't mess up
  54. tabs, but yank-n-stuff does translate them into spaces.  The
  55. listing given when you type ":map" in vi shows them as "^I".
  56.  
  57.  
  58. Basically, you can't just edit what you see in the news to
  59. make vi macros.  You have to figure out what you're looking
  60. at and make sure to use real control characters in the
  61. right places.
  62.  
  63.                 --Blair
  64.                   "map V o^I^I^I^I--Blair^M  ""
  65.  
  66. P.S.  I'm not going to be so crass as to suggest that this
  67. sub-notation {--,**,b,t..t} be adopted as a standard.
  68. Posters should just be clear about what they mean when they
  69. post control sequences.
  70.