Use `\r\n` for new files on Windows (#1596)

* Use `\r\n` for new files on Windows

* Add `config.line_endings`
This commit is contained in:
Guldoman 2023-11-30 16:51:10 +01:00 committed by GitHub
parent 142f0a17ba
commit 9a4831d5c2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 0 deletions

View File

@ -153,6 +153,12 @@ config.tab_type = "soft"
---@type boolean
config.keep_newline_whitespace = false
---Default line endings for new files.
---
---Defaults to `crlf` (`\r\n`) on Windows and `lf` (`\n`) on everything else.
---@type "crlf" | "lf"
config.line_endings = PLATFORM == "Windows" and "crlf" or "lf"
---Maximum number of characters per-line for the line guide.
---
---Defaults to 80.

View File

@ -28,6 +28,9 @@ function Doc:new(filename, abs_filename, new_file)
self:load(filename)
end
end
if new_file then
self.crlf = config.line_endings == "crlf"
end
end
function Doc:reset()