Change inside comments with Vim

block-commentkeyboard shortcutsvim

Is there a way to change inside of a comment with Vim? I know you can change inside brackets and quotes with i] and i". For example, If you are on a quote you can press,

ci"my new textESC

And this will replace the text inside of the quote with the phrase "my new text", but how can I do the same thing with C comments which are enclosed with /* and */?

Best Answer

The Vim term for text that can be selected, yanked, deleted, and modified based on certain groupings of characters is text object (see :help text-objects). There's a comment-aware text object plugin called textobj-comment.

Related Question