home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.editors
- Path: sparky!uunet!utcsri!torn!cunews!nrcnet0!bnrgate!bcars267!news
- From: Reg Foulkes
- Subject: Re: Capitalizing first [a-z] letter in sentence in vi
- Message-ID: <1992Jul23.131525.19369@bnr.ca>
- Sender: news@bnr.ca (usenet)
- Nntp-Posting-Host: bpinm17
- Organization: Bell-Northern Research
- References: <1992Jul20.233831.9582@sci.kun.nl> <1992Jul21.224816.25122@news.acns.nwu.edu> <1992Jul22.141433.26865@sci.kun.nl> <1992Jul22.215752.19032@news.acns.nwu.edu> <1992Jul23.010424.4048@sci.kun.nl>
- Date: Thu, 23 Jul 1992 13:15:25 GMT
- Lines: 33
-
- In article <1992Jul23.010424.4048@sci.kun.nl> hansm@cs.kun.nl (Hans Mulder)
- writes:
-
- >It dissects as follows:
- >
- >: Means that it's an ex command.
- >1,$-1 The range of lines it must be applied to: from the first till
- > the second last. Your problem is that the last line ends
- > in one of [.!?] and you can't ~ the first char of the last
- > line +1, because there are "Not that many lines in buffer".
- >g Short for global. Applies the +s/[a-z]/\u& command to all
- > lines matching the pattern /[.!?])*[ ]*$/.
- >/[.!?])*[ ]*$/ Pattern for lines ending in one of [.!?], possibly some )
- > and white space. Add a tab between the [] if necessary.
- >+ Short for .+1 i.e. apply the s/// bit to the next line
- >s/[A-Za-z]/ Replace the first letter...
- >\u ...by upper case of version of...
- >& ...whatever matched the first argument.
- >
- >In the second argument of the s/// command, the magic sequence \u changes
- >the next letter to upper case, \U changes everything to upper case until
- >the next \e or \l or whatever. The lower case versions are \l and \L.
- >
- >--
- >Hope this helps,
-
- Hans,
- What a beautiful piece of work. Care to write a book on vi?
-
- --------------------------------
- Reg Foulkes Bell-Northern Research
- riskit@x400gate.bnr.ca 2745 Iris Street
- Telephone :(613) 763-4131 Ottawa, Ontario., Canada K1Y 4H7
-