Fixing too long comment lines in Vim

Posted by Tomek Kaftal on Stack Overflow See other posts from Stack Overflow or by Tomek Kaftal
Published on 2012-09-01T21:37:08Z Indexed on 2012/09/01 21:37 UTC
Read the original article Hit count: 167

Filed under:
|

I'm looking for a convenient way to fix comments where line lengths exceed a certain number of characters in Vim. I'm fine with doing this manually with code, especially since it's not that frequent, plus refactoring long lines is often language, or even code-style dependent, but with comments this is pure drudgery.

What happens is I often spot some issue in a comment, tweak one or two words and the line spills out of the, say, 80 character limit. I move the last word to the next line and then the next line spills, and so on. Does anyone know a way to do this automatically in Vim?

© Stack Overflow or respective owner

Related posts about vim

Related posts about vimrc