Small Capitalizing

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Small Capitalizing

Jabba Laci
Hi,

How to small capitalize a text? I found "gu" and "gU", but not this one.
Example: "change this text"  =>  "Change This Text"

I'd prefer it in visual mode.

            Thanks,

                       Jabba
Reply | Threaded
Open this post in threaded view
|

Re: Small Capitalizing

Tim Chase-2
 > How to small capitalize a text? I found "gu" and "gU", but
 > not this one.  Example: "change this text"  =>  "Change
 > This Text"
 >
 > I'd prefer it in visual mode.

In the general case (non-visual mode, or linewise) you can
use

     s/\<\(\w\)\(\w*\)\>/\u\1\L\2/g

For characterwise selections, you can use the following

     vnoremap <f4> c<c-r>=substitute(@", '\<\(\w\)\(\w*\)\>',
     '\u\1\L\2', 'g')<cr><esc>

For block-wise selections, you may have to turn to Dr.
Chip's VisVim plugin to perform a similar stunt.

Hope this gives you some ideas to work with,

-tim