141179Re: How to capitalize the first letter of each word?
- Feb 8, 2014On Saturday, February 8, 2014 9:57:26 AM UTC-8, Bee wrote:
> On Saturday, February 8, 2014 7:06:51 AM UTC-8, Tim Chase wrote:Thank you for this thread...
> > On 2014-02-08 08:53, Peng Yu wrote:
> > > I need to capitalize the first letter of each word within a visual
> > > block. Is there a quick way to do it vim? Thanks.
> > You might try
> > :'<,'>s/\%V\<./\u&/g
> > which could be easily mapped if you do it frequently.
> 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?
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>
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
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@....
For more options, visit https://groups.google.com/groups/opt_out.
- << Previous post in topic