In the context of text files, line endings or encoding refer to the characters that are used to indicate the end of a line of text.
There are three main types of line endings used in modern operating systems.
- Carriage return (CR) - used by older Macintosh Operating Systems
- Line feed (LF) - used by Unix/Linux Operating Systems
- Carriage return + line feed (CRLF) - used by Windows Operating Systems
To change the line endings (encoding) in Sublime Text, you can use the "Line Endings" option in the "View" menu. Here are the steps:
- Open the text file in Sublime Text App.
- Go to the Menu: View.
- Move your cursor to "Line Endings" and you will see the available options: Windows, Unix, and Mac OS 9.
- Select the desired line ending format.
Once you select a line ending format, Sublime Text will automatically convert the line endings in the text file to the selected format.
Set Default Line Ending for all files
You can also configure Sublime Text to use a specific default line-ending format for all new files you create. To do this, go to the "Preferences" menu and select "Settings" (Sublime Text -> Settings -> Settings on macOS). In the right-hand pane, add the following line to the user preferences file.
Example:"default_line_ending": "unix"
Facing issues? Have Questions? Post them here! I am happy to answer!
Rakesh (He/Him) has over 14+ years of experience in Web and Application development. He is the author of insightful How-To articles for Code2care.
Follow him on: X
You can also reach out to him via e-mail: rakesh@code2care.org
- Sublime Text 3 Convert Case to Upper, Lower, Title or Swap
- Change Sublime Text 3 white background color theme
- Replace new line with comma in Sublime Text Editor
- Word count in Sublime Text Editor
- How to add ruler in Sublime Text tab window
- How to Set Permanent ruler in Sublime Text
- How to install Packages in Sublime Text Editor
- Change Line Endings (Encoding Windows/Mac/Unix CR/LF/CRLF) Sublime Text
- Steps to Compare Two files in Sublime Text Side-by-Side
- How to find Sublime Text path of packages installed
- How to display File CR LF Newline Characters in Sublime Text
- How to add Multiple Rulers in Sublime Text
- How to shuffle lines randomly in Sublime Text
- Maven BUILD FAILURE: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin - Java
- Copy all .vcf Mobile Contacts files into one .vcf - HowTos
- Steps to Integrate Latest Facebook SDK with your Android Application - Facebook
- How to make Mac Terminal Black - MacOS
- Fix: Jupyter Notebook says Not Trusted - Python
- What is $$ in Bash Shell Script- Special Variable - Bash
- Sublime Text 3 spell check shortcut - Sublime
- Fix: bash: ipconfig: command not found on Linux - Linux