I have been using:
" Titlecase A Line Or Selection
vmap \<F6> :s/\%V\<./\u&/ge<cr>
nmap \<F6> V\<F6>
imap \<F6> <C-O>\<F6>
I have incsearch set and would like to turn off highlighting after the search. I have a mapping to do this manually:
" manually disable search highlight
nmap <silent> <F4> :nohlsearch<cr>
imap <F4> <C-O><F4>
vmap <F4> <esc><F4>gv
I tried to combine the search replace with nohl but it did not work:
vmap \<F6> :s/\%V\<./\u&/ge<cr> | :nohlsearch
Is there a way to do this?
Thanks for pointing out the very elegant solution of using :s to uppercase every first character. I created a plugin some time ago that would work for all scenarios except visual-block mode. Thanks to your answer, I was able to complete it. The result can be downloaded here: https://raw.github.com/jceb/vimrc/master/plugin/capitalize.vim
Cheers,
Jan Christoph
Thank you for this thread...
I decided to try other options,
such as changing only lowercase letters:
vmap \<F6> :s/\%V\<\l/\u&/ge<cr>
When the substitute is complete,
there are no longer any lowercase letters and
therefor no highlighting!
Also this seems to be useless:
imap \<F6> <C-O>\<F6>