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
574 views
in Technique[技术] by (71.8m points)

windows - How can I make all line endings (EOLs) in all files in Visual Studio Code, Unix-like?

I use Windows 10 Home and I usually use Visual Studio Code (VS Code) to edit Linux Bash scripts as well as PHP and JavaScript.

I don't develop anything dedicated for Windows and I wouldn't mind that the default EOLs for all files I edit whatsoever would be Unix like (nix).

How could I ensure that all EOLs, in all files whatsoever (from whatever file extension), are nix, in Visual Studio Code?


I ask this question after I've written a few Bash scripts in Windows with Visual Studio Code, uploaded them to GitHub as part of a project, and a senior programmer that reviewed the project told me I have Windows EOLs there and also a BOM problem that I could solve if I'll change the EOLs there to be nix (or that's what I understood, at least).


Because all my development is Linux-oriented, I would prefer that by default, any file I edit would have nix EOLs, even if it's Windows unique.

See Question&Answers more detail:os

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

1 Answer

0 votes
by (71.8m points)

The accepted answer explains how to do this for all files (use files.eol in settings), but if you ever need to override that setting there's an indicator at the bottom right that you can click on and change for this one file. Took me a while to notice that this was clickable.

See CRLF in the message bar at the bottom right


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

...