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
- JSON column formatting to preview SharePoint Online file on mouse hover - SharePoint
- How to list all versions of Python Modules Available using pip/pip3 - PIP
- Microsoft Teams - Where would you like to start - Business or Personal - Teams
- How to find the Length of ArrayList in Java - Java
- How to install Terraform on M1/M2 Mac - MacOS
- Fix: Error: error:0308010C:digital envelope routines::unsupported NodeJs/Vue/React - JavaScript
- Convert JSON to Gson with type as ArrayList - Java
- How to check if an element is hidden using jQuery code? - jQuery