Monday, May 25, 2015

Re: Newbie question about mapping...

You could start the command by inserting a character and delete it after you get back in insert mode:
 
  :inoremap <c-d> _<esc>viwU<esc>gi<bs>
 
Also, the second esc is useless since pressing U should take you back to normal mode:
 
  :inoremap <c-d> _<esc>viwUgi<bs>
 
And, although it's not wrong to go into visual mode to set some text uppercase, it's interesting to know vim has normal mode commands to change the case of letters. For example, to set the current word to uppercase, you could use gUiw. For more informations: :h case
 
Youen

No comments:

Post a Comment