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: <1992Jul22.141433.26865@sci.kun.nl>
- Sender: news@sci.kun.nl (NUnet News Owner)
- Organization: University of Nijmegen, The Netherlands
- 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>
- Date: Wed, 22 Jul 1992 14:14:33 GMT
- Lines: 62
-
- In <1992Jul21.224816.25122@news.acns.nwu.edu> navarra@casbah.acns.nwu.edu (John Navarra) writes:
- >In article <1992Jul20.233831.9582@sci.kun.nl> I wrote:
- >>:write " Just in case....
- >>:set nowrapscan magic remap noignorecase
- >>:map K n~Kq "The q stops vi from saying "No tail recursion".
-
- > :map K nw~Kq "need the w to goto beginning of next word.
-
- Oops. You're right.
-
- >>/[.!*] [ ]*[a-z]
-
- > /[.!?*] [ ]*[a-z] "add '?' to the search pattern.
-
- You might even consider:
-
- /[.!?*])* [ ]*[a-z]/ "add the option of a ')' or two
-
- Note that you need to add a closing '/' to a search pattern if you
- want to add a "comment. [ Does anyone ever do that? ]
-
- >>1GK
- >>:unmap K " Too dangerous to leave it around.
- >>:set wrapscan ignorecase " Whatever you like.
-
- > " if you set ignorecase and reissue the
- > command, then all changes will be undone
- > (in case you didn't like it)
-
- Well, no. Not if you've :unmapped it. And even if you hadn't, it would
- change to lowercase the first letters of many sentences that began with an
- uppercase letter originally. And the 'u' command doesn't cut it, either.
-
- The remarkably simple way to undo all those changes is:
-
- :e!
-
- This works because there's a :write at the start of the sequence.
-
- >Now, onto phase 2:
- > So far, this is very good. The only problem I have now is getting
- >sentences which begin a newline. For example.
-
- >this is a sentence on the current line[.!?] followed by another sentence[.!?]
- >and here is the beginning of a new sentence on a new line.
-
- >Any more ideas on this?
-
- How about:
-
- :g/[.!?])*[ ]*$/+s/[a-z]/\u&
-
- For that matter,
-
- :%s/[.!?*])* [ ]*[a-z]/\U&/g
-
- looks like an alternative solution to the question in phase 1.
-
- --
- Hope this helps,
-
- Hans Mulder hansm@cs.kun.nl
-