3

What's the best way to remap w/W to stop in the middle of sub_words and subWords?

I have some text objects installed but I mapping w to vav<esc> (select next subword and deselect) doesn't get me anywhere.

Help.

firedev
  • 20,898
  • 20
  • 64
  • 94

1 Answers1

6

Have a look at my camelcasemotion plugin. It provides motions and text objects for that. You can optionally even replace the built-in w, e, etc. commands with them!

Ingo Karkat
  • 167,457
  • 16
  • 250
  • 324
  • God, this is perfect thanks! Guess I didn't use your plugin before because it was in vim-scripts only and looked deserted. Can you please add an option to disable default `,` mappings though? – firedev Oct 29 '14 at 12:09
  • If you customize the mappings, the default `,w` etc. mappings won't be defined. – Ingo Karkat Oct 29 '14 at 12:25
  • I did copy all mappings from docs (`wbe` and `iwbe`) but I still can do `,wbe`. https://github.com/firedev/dotfiles/blob/master/vimrc – firedev Oct 29 '14 at 12:35
  • Does `:verbose nmap ,w` actually list a mapping to camelcasemotion? It might be that the `,` is just ignored (with a beep) by Vim. – Ingo Karkat Oct 29 '14 at 12:50
  • Sorry, my bad, probably was too excited to notice `,w` is actually just `w`. – firedev Oct 29 '14 at 15:04
  • Hey Ingo, if you have a word at the end of a line and you do `cw` it deletes the trailing newline as well and joins the next line. Could you please check it? – firedev Nov 30 '14 at 01:58