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 */?

  • Maybe with the %? But you'd need to be at the start or the end of the comment. Sep 7, 2014 at 23:32

1 Answer 1


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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .