How to make all line endings (EOLs) in all files in Visual Studio Code, UNIX like?

user9303970 picture user9303970 · Feb 8, 2018 · Viewed 57.8k times · Source

I use Windows 10 home and I usually use Visual Studio Code (VSCODE) 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 VSCODE?


I ask this question after I've written a few Bash scripts in Windows with VSCODE, 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 Window unique.

Answer

Ian McGowan picture Ian McGowan · Feb 8, 2018

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