How to change the line ending used in Netbeans

风流意气都作罢 提交于 2019-12-17 19:27:12

问题


Netbeans has this wiki entry on line endings: http://wiki.netbeans.org/FaqEditorEOLs

But it isn't very useful. It just says that you shouldn't develop on different OS and that's that...

In my situation however, I have no power over it. I'm on a windows machine and the PHP app I'm working on needs to end with the UNIX EOL.

There does not seem to be an option to set this for new files. Can anyone tell me where to set this?


回答1:


Just saw that you can set this as a command-line startup flag: -J-Dline.separator=LF

I haven't tested this myself but I'm looking for ways to bake this into the configs somehow.




回答2:


Since, a specific plug-in came out: http://plugins.netbeans.org/PluginPortal/faces/PluginDetailPage.jsp?pluginid=36810

I also like @JimLewis suggestion but I work on Windows with a linux virtual machine thus in some cases the versioning system line ending cannot help.

[update 201709] I no longer use netbeans (sorry, but I need python support and it's too buggy) and almost no longer develop on windows, but @marinos-an in a comment suggests https://github.com/welovecoding/editorconfig-netbeans which uses a common setting file that can be picked up by multiple editors through plugins. Definitely interesting to try since the settings file is committable!




回答3:


Have you considered managing the line endings at the version control level? Subversion, for example, lets you set an "eol-style" attribute with values "LF", "CR", "CRLF", and "native" (which translates the line endings stored in the repository to whatever is appropriate for the platform where the files are being checked out, and converts the other way when you check in.)




回答4:


Please use following Netbeans Plugin

http://plugins.netbeans.org/plugin/36810/show-and-change-line-endings




回答5:


fentie's answer solved my problem with line endings, as pasting multi-line MySQL from NetBeans into the MySQL command prompt caused errors.

To pass this argument to NetBeans every time it opens, add it to the netbeans.conf file:

/Applications/NetBeans/NetBeans\ 7.1.2.app/Contents/Resources/NetBeans/etc/netbeans.conf on OS X.

From the NetBeans Mac page under Tips & Tricks.

When I pasted multi-line SQL statements from NetBeans to the MySQL command line client on OS X or a remote Linux server, MySQL would list all possible command choices, give me some strange '> type of prompt and I was forced to hit Ctrl+C and log back into MySQL again.



来源:https://stackoverflow.com/questions/3294451/how-to-change-the-line-ending-used-in-netbeans

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!