I am new to Sublime Text and I saw there's a setting of Line Endings which allows me to change it to 'windows','UNIX' and 'mac os'. Can someone explain to me? Thx~
-
Take a look here: https://en.wikipedia.org/wiki/Newline#Common_problems – eithed Jul 06 '16 at 13:27
1 Answers
Before there was computers, people wrote text on a typewriters. To get to a new line on your paper, you need to feed a line (scroll the paper one line up) and do a carriage return (put the pointer on the beginning of the line).
New technologies adapted these techniques. On UNIX-like systems, native editors will not set a carriage-return (CR) flag, but only a line-feed (LF). In Windows, line endings are denoted with both CR and LF. The Mac OS setting refers to the classic Mac OS (pre-OS X), which used only CR. Modern Mac OS (OS X and macOS) uses LF, as it is UNIX-based. The Wikipedia article on Newline has a good overview.
If you are working with Windows only, leave it as it is. If you need to swap files between UNIX-like and Windows systems, set the editor on Windows to use UTF-8 encoding for files and line_ending to LF only. That way you will circumvent many problems with encoding on linux/mac machines.

- 239,200
- 50
- 490
- 574

- 1,219
- 14
- 24