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:
parent
142f0a17ba
commit
9a4831d5c2
|
@ -153,6 +153,12 @@ config.tab_type = "soft"
|
||||||
---@type boolean
|
---@type boolean
|
||||||
config.keep_newline_whitespace = false
|
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.
|
---Maximum number of characters per-line for the line guide.
|
||||||
---
|
---
|
||||||
---Defaults to 80.
|
---Defaults to 80.
|
||||||
|
|
|
@ -28,6 +28,9 @@ function Doc:new(filename, abs_filename, new_file)
|
||||||
self:load(filename)
|
self:load(filename)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
if new_file then
|
||||||
|
self.crlf = config.line_endings == "crlf"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function Doc:reset()
|
function Doc:reset()
|
||||||
|
|
Loading…
Reference in New Issue