Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
280 views
in Technique[技术] by (71.8m points)

PhpStorm saving with Linux line ending on Windows

Environment: Windows + PhpStorm

Issue: PhpStorm saves file with Windows line endings - and for shell script it's issue so there is need to always convert after copying to server.

Question: Is possible to configure PhpStorm to save file with Linux line endings - and not (new line + carriage return)?

question from:https://stackoverflow.com/questions/40470895/phpstorm-saving-with-linux-line-ending-on-windows

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

You can safely use line ending for .php and most of other files as well -- PHP on Windows will read such files just fine.


To set default line ending for all new files: go to Settings/Preferences | Editor | Code Style and change Line separator (for new files) option to the desired style (e.g. Unix and OS X ( )).

enter image description here


To change line ending for a particular existing file: open the file and either change it via appropriate section in Status Bar .. or via File | File Properties | Line Separators

enter image description here

enter image description here


P.S.

If you do have EditorConfig plugin installed and enabled ... you might also configure this via .editorconfig file -- there you may specify what line ending to use (this can be done on per file extension level .. so it's more flexible than PhpStorm's own setting).

This will also work in another editor/IDE that supports such file.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...