# Add \`line_ending\` setting to control line-ending normalization \(\#54356\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/2a6ee04013eac19eef87dcafa90fc6e081e7e19c)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: 2a6ee04013eac19eef87dcafa90fc6e081e7e19c

Requested commit: 2a6ee04013eac19eef87dcafa90fc6e081e7e19c

Commit: 2a6ee04013eac19eef87dcafa90fc6e081e7e19c

Tree: 31a987d2b925135111eab74b6aa4133a971183c1

Author: melocene

Committer: GitHub

## Message

```
Add `line_ending` setting to control line-ending normalization (#54356)

Closes #49581

Adds a `line_ending` language setting that controls how line endings are
handled for new files and during format/save:

- `detect` (default) — detects existing line endings; new files use the
platform default
- `prefer_lf` / `prefer_crlf` — sets LF or CRLF for new files and files
with no existing convention, while preserving existing files
- `enforce_lf` / `enforce_crlf` — normalizes all line endings to LF or
CRLF on every format/save

The setting can be configured globally, per-language, or via
`.editorconfig`'s `end_of_line` property (which maps to `enforce_lf` /
`enforce_crlf`).

Release Notes:

- Added `line_ending` setting to control how line endings are handled
for new files and normalized on save.
- Added support for `.editorconfig` `end_of_line` property to enforce
line endings.

---------

Co-authored-by: Smit Barmase <heysmitbarmase@gmail.com>
```

## Parents

- [c97442029aa8e1599661b171ad3f4e3161efc8de](https://git.cafe/gitcafe/zed/commit/c97442029aa8e1599661b171ad3f4e3161efc8de?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/2a6ee04013eac19eef87dcafa90fc6e081e7e19c?format=markdown)
