On 04/26/2011 11:17 AM, Bee wrote:
I have a mapping that works great to Title Case A Line:

" Title Case A Line "? only selection
vnoremap<F6>  :s/\<\(\w\)\(\w*\)\>/\u\1\L\2/ge<cr>
nmap<F6>  V<F6>
imap<F6>  <Esc><F6>i

There is one problem, sometimes I would like to Title Case only a
portion of a line but this will still do the whole line.

To apply it to visual block only, add \%V :

:s/\%V\<\(\w\)\(\w*\)\>/\u\1\L\2/ge


-Rainyday


I also tried it without the "g" but then it only does the first word.

vnoremap<F6>  :s/\<\(\w\)\(\w*\)\>/\u\1\L\2/e<cr>

-Bill


--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Reply via email to