跨平台编码\r\n vs \n

时间:2020-11-30 19:37:03

We are collaborating on a project with several team members who are using Mac, Windows and Unix based systems. I am curious if text can be configured to issue a \n instead of a \r\n at an end of line on a windows system to conform to unix standards? We are using UTF8

我们正在与几个使用Mac、Windows和Unix系统的团队成员合作一个项目。我很好奇文本是否可以配置为在windows系统的行尾发出一个\n而不是一个\r\n,以符合unix标准?我们使用的是UTF8

1 个解决方案

#1


2  

Yes, this is possible. Add the following to your preferences file, or to the shared .sublime-project file:

是的,这是可能的。向您的首选项文件或共享的.sublime-project文件添加以下内容:

"default_line_ending": "unix"

This overrides the default value of "system". Note that this is only for new files. To change the line endings in an existing file, go to View -> Line Endings and select Unix.

这将覆盖“系统”的默认值。注意,这只适用于新文件。要更改现有文件中的行结束,可以查看->行结束并选择Unix。

#1


2  

Yes, this is possible. Add the following to your preferences file, or to the shared .sublime-project file:

是的,这是可能的。向您的首选项文件或共享的.sublime-project文件添加以下内容:

"default_line_ending": "unix"

This overrides the default value of "system". Note that this is only for new files. To change the line endings in an existing file, go to View -> Line Endings and select Unix.

这将覆盖“系统”的默认值。注意,这只适用于新文件。要更改现有文件中的行结束,可以查看->行结束并选择Unix。