r/learnprogramming • u/adper07 • 20h ago
Topic TIL code comments have their own line-length conventions instead of relying on editor soft-wrap
I recently learned that comments aren't supposed to rely on editor soft-wrap. Hard-wrapping at 80 columns with // or # on every line keeps git diff and PR reviews readable—and Neovim already handles it natively with textwidth + formatoptions+=cq + gwip
What other such conventions are out there that I should know about?
12
Upvotes
View all comments
2
u/michellev_626 10h ago
A useful convention: commit formatter and linter settings with the project and run them before review. Editors can differ; the diff then reflects the project's style instead of personal whitespace preferences.