I like to keep comments in code to ~72 characters per line for readability. I can get this to work for top-level, left-aligned comments easily by running gqq. However, if a comment is nested 2-3 levels deep, I don’t want the comment to be truncated by that much indentation.
My current workflow is to de-indent the section, run the format command, then re-indent it. Is there a better way?
if (some_condition) {
// This comment can go to about where the caret is before I'd like to
// insert a newline.
^
if (something_else) {
// However, this line begins at a deeper level of indentation, so I can
// go further in absolute line length, while the length of the actual
// text is the same.
^
}
}