How do I switch between Windows and UNIX newlines

2019-02-05 20:10发布

The version of NetBeans that I use is 6.5.1

9条回答
三岁会撩人
2楼-- · 2019-02-05 20:58

Quoted from the Netbeans Wiki:

NetBeans editor respects the line separator used in an existing file. It reads the file into an editor document instance in the following way:

  • First line of the file is read and the line separator type is determined - it is expected to be one of

    • "\n" (LF)- Unix
    • "\r" (CR)- Mac
    • "\r\n" (CRLF) - Windows
  • The line separator type is remembered in the document instance for future save operation.

  • All the lines in the file are read and their line separator (regardless of what type it is) is translated to "\n" that is the only line separator type that the editor is able to work with.
  • Upon save operation each "\n" in the document is translated into the remembered line separtor type.

Note: If there would be a mixture of line separators of multiple types throughout the file then only the line separator type from the original first line will be used upon save.

For new files (constructed from templates) the editor uses platform-default line separator.

Update:

As of Netbeans 7.3 there is a new change-line-endings-on-save plugin that allows you to configure line endings globally or per-project.

查看更多
啃猪蹄的小仙女
3楼-- · 2019-02-05 21:08

Install http://plugins.netbeans.org/plugin/36810/show-and-change-line-endings in netbean and it will show the line break in bottom right task bar inside netbean also you can switch between Windows, Linux and Mac.

查看更多
登录 后发表回答