>I have a text with many quotations, that I want to change the case. 
>Currently the text of the quote is in all caps. I want to change it to 
>capitalize only the first letter of each word. The text I want to
change 
>can be either a single word, multiple words on a single line, or 
>multiple words on multiple line, as follows:

If you know the beginning/ending lines (absolute numbers, marks, etc.),
you can do

        :'m,'ns/.*/\L&/gp                       marks 'm' and 'n' set
previously
        :'m,'ns/.*/\u&/gp

        :10,50s/.*/\L&/gp                       absolute linenos 10
through 50 inclusive
        :10,50s/.*/\u&/gp

etc.

'&' is the matched pattern.  "\L&" will take the matched pattern and
lcase it all, then "\u&" will just ucase the initial letter of a word.
So each respective pass will be

        WORDS TO INITCAP                originally
        words to initcap                after lcasing it all
        Words To Initcap                after the initcap

Someone here might have a more elegant way of doing it, but I've done it
this way in the past for so long it's practically a macro to me.

Fwiw:

        \L      lcase everything
        \l      lcase initial letter of each word
        \U      ucase everything
        \u      ucase initial letter of each word

Hth.

Reply via email to