The current project I’m working requires me to follow certain procedures to eliminate whitespace in my code. Apparently this has got something to do with line endings since one requirement explicitly tells me to “end all lines with a Unix line ending (\n)”.
I code in VIM from the terminal, and I press enter for a new line to write on. Am I missing something here?
What is the reason to keep the code clean from trailing whitespace and using specific types of line breaks?
On a side note, what standard VI/VIM settings do you guys use to adhere to common coding standards?
Sincerely,
Why
Different operating systems have different line break conventions. Unix-like systems prefer
\n(LF); Windows prefers\r\n(CR LF); pre-OSX Mac OS used\r(CR). Maintaining one convention across a project is usually a good idea.As for trailing whitespace, AFAIK it’s just sloppy (may indicate “quick and dirty” reformatting). In some environments trailing whitespace might also be significant.