Loading ...
Sorry, an error occurred while loading the content.

141176Re: How to capitalize the first letter of each word?

Expand Messages
  • Bee
    Feb 8, 2014
    • 0 Attachment
      On Saturday, February 8, 2014 7:06:51 AM UTC-8, Tim Chase wrote:
      > 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?

      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.
    • Show all 9 messages in this topic