home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.editors
- Path: sparky!uunet!mcsun!sun4nl!wn1.sci.kun.nl!cs.kun.nl!hansm
- From: hansm@cs.kun.nl (Hans Mulder)
- Subject: Re: Capitalizing first [a-z] letter in sentence in vi
- Message-ID: <1992Jul23.135305.2389@sci.kun.nl>
- Sender: news@sci.kun.nl (NUnet News Owner)
- Organization: University of Nijmegen, The Netherlands
- References: <1992Jul22.141433.26865@sci.kun.nl> <1992Jul22.215752.19032@news.acns.nwu.edu> <1992Jul23.010424.4048@sci.kun.nl> <1992Jul23.102852.1466@news.acns.nwu.edu>
- Date: Thu, 23 Jul 1992 13:53:05 GMT
- Lines: 33
-
- In <1992Jul23.102852.1466@news.acns.nwu.edu> navarra@casbah.acns.nwu.edu (John Navarra) writes:
- >In article <1992Jul23.010424.4048@sci.kun.nl> I wrote:
- >>:1,$-1g/[.!?])*[ ]*$/+s/[A-Za-z]/\u&
- > The only instances where this misses, that I can see, are as
- >follows:
-
- >1) It misses the first line because there is no punctutation before the
- > first sentence.
-
- >2) It misses instances where there are blank lines in between two
- > sentences.
-
- OK, fourth attempt:
-
- :g/[.!?])*[SPACETAB]*$//[A-Za-z]/s//\u&
-
- I.e. replace the + ("next line") by a search for a line that actually
- has a letter on it. This obviously soves problem 2. If you have the
- wrapscan option set, it also solves your first line problem, plus the
- "Not that many lines in buffer" problem in your previous post.
-
- Incidentally, in this sort of construct the pattern to the left of
- the s/// is the default for its first argument.
-
- >Getting tired of this yet? ;-(
-
- Well, I'm going on holiday tomorrow; so it may take a while before
- you see my next attempt.
-
- --
- Hope this helps,
-
- Hans Mulder hansm@cs.kun.nl
-