home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / editors / 1797 < prev    next >
Encoding:
Text File  |  1992-07-22  |  2.2 KB  |  74 lines

  1. Newsgroups: comp.editors
  2. Path: sparky!uunet!mcsun!sun4nl!wn1.sci.kun.nl!cs.kun.nl!hansm
  3. From: hansm@cs.kun.nl (Hans Mulder)
  4. Subject: Re: Capitalizing first [a-z] letter in sentence in vi
  5. Message-ID: <1992Jul22.141433.26865@sci.kun.nl>
  6. Sender: news@sci.kun.nl (NUnet News Owner)
  7. Organization: University of Nijmegen, The Netherlands
  8. References: <1992Jul19.023521.29749@tamsun.tamu.edu> <1992Jul20.211903.28367@news.acns.nwu.edu> <1992Jul20.233831.9582@sci.kun.nl> <1992Jul21.224816.25122@news.acns.nwu.edu>
  9. Date: Wed, 22 Jul 1992 14:14:33 GMT
  10. Lines: 62
  11.  
  12. In <1992Jul21.224816.25122@news.acns.nwu.edu> navarra@casbah.acns.nwu.edu (John Navarra) writes:
  13. >In article <1992Jul20.233831.9582@sci.kun.nl> I wrote:
  14. >>:write                " Just in case....
  15. >>:set nowrapscan magic remap noignorecase
  16. >>:map K n~Kq            "The q stops vi from saying "No tail recursion".
  17.  
  18. > :map K nw~Kq            "need the w to goto beginning of next word.
  19.  
  20. Oops.  You're right.
  21.  
  22. >>/[.!*] [ ]*[a-z]
  23.  
  24. > /[.!?*] [ ]*[a-z]        "add '?' to the search pattern.
  25.  
  26. You might even consider:
  27.  
  28. /[.!?*])* [ ]*[a-z]/        "add the option of a ')' or two
  29.  
  30. Note that you need to add a closing '/' to a search pattern if you
  31. want to add a "comment.  [ Does anyone ever do that? ]
  32.  
  33. >>1GK
  34. >>:unmap K            " Too dangerous to leave it around.
  35. >>:set wrapscan ignorecase    " Whatever you like.
  36.  
  37. >                " if you set ignorecase and reissue the
  38. >                   command, then all changes will be undone
  39. >                  (in case you didn't like it)
  40.  
  41. Well, no.  Not if you've :unmapped it.  And even if you hadn't, it would
  42. change to lowercase the first letters of many sentences that began with an
  43. uppercase letter originally.  And the 'u' command doesn't cut it, either.
  44.  
  45. The remarkably simple way to undo all those changes is:
  46.  
  47. :e!
  48.  
  49. This works because there's a :write at the start of the sequence.
  50.  
  51. >Now, onto phase 2:
  52. >    So far, this is very good. The only problem I have now is getting
  53. >sentences which begin a newline. For example.
  54.  
  55. >this is a sentence on the current line[.!?] followed by another sentence[.!?]
  56. >and here is the beginning of a new sentence on a new line.
  57.  
  58. >Any more ideas on this?
  59.  
  60. How about:
  61.  
  62. :g/[.!?])*[ ]*$/+s/[a-z]/\u&
  63.  
  64. For that matter,
  65.  
  66. :%s/[.!?*])* [ ]*[a-z]/\U&/g
  67.  
  68. looks like an alternative solution to the question in phase 1.
  69.  
  70. --
  71. Hope this helps,
  72.  
  73. Hans Mulder            hansm@cs.kun.nl
  74.