rACkle
rACkle

Reputation: 813

How to set default line endings in Visual Studio Code?

I have an autosetting for Windows somewhere (CRLF) which is really annoying, is there a way to change this to Unix?

Upvotes: 54

Views: 65725

Answers (3)

Akaisteph7
Akaisteph7

Reputation: 6554

Two things to do:

  1. To change all line endings from CRLF to LF on a Windows machine for a cloned repository. From the repository root folder, run:

    git config core.autocrlf false
    
    git rm --cached -r .         # Don’t forget the dot at the end
    
    git reset --hard
    
    git status
    
  2. Using Windows-installed Github Desktop is not a good idea if using WSL. It seems there's quite a delay in reading between the Windows install and WSL files. So, it is better to just use source control features built into VSCode with the helpful WSL integration extension.

Upvotes: 0

David Bakare
David Bakare

Reputation: 983

  • Open VSCode settings: Cmd / Ctrl + ,
  • Search for eol in settings and click on \n to make LF default.

enter image description here

Upvotes: 90

Uliana Pavelko
Uliana Pavelko

Reputation: 2952

Open VS code window then Ctrl+Shift+P to open settings and search for EOL like @David Bakare suggested above.

Upvotes: 4

Related Questions