开发者

How to change the line ending used in Netbeans

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 ha开发者_StackOverflow中文版ve 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?


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.


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!


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.)


Please use following Netbeans Plugin

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


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.


For my Netbeans 12.6

I found a pluging called "Change Line Endings on Save"

https://plugins.netbeans.apache.org/catalogue/?id=31

more details are there

https://github.com/junichi11/netbeans-change-lf

once pluging installed you can configure EOL in there:

Tools > Options > Editor > Line Endings

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜