diff --git a/data/core/config.lua b/data/core/config.lua index 2381639f..88f8d96d 100644 --- a/data/core/config.lua +++ b/data/core/config.lua @@ -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. diff --git a/data/core/doc/init.lua b/data/core/doc/init.lua index 3c0a30d7..e44610e5 100644 --- a/data/core/doc/init.lua +++ b/data/core/doc/init.lua @@ -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()