Tuesday, April 26, 2011

Title Case Selection Only?

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.

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

No comments:

Post a Comment