Make default fileformat value suited to the OS (#3141)

Set fileformat by default to `dos` on Windows.
This commit is contained in:
Dmytro Maluka 2024-03-04 22:20:02 +01:00 committed by GitHub
parent 59dda01cb7
commit af2ec9d540
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 10 additions and 2 deletions

View File

@ -8,6 +8,7 @@ import (
"os"
"path/filepath"
"reflect"
"runtime"
"strconv"
"strings"
@ -284,7 +285,7 @@ var defaultCommonSettings = map[string]interface{}{
"encoding": "utf-8",
"eofnewline": true,
"fastdirty": false,
"fileformat": "unix",
"fileformat": defaultFileFormat(),
"filetype": "unknown",
"hlsearch": false,
"incsearch": true,
@ -319,6 +320,13 @@ var defaultCommonSettings = map[string]interface{}{
"wordwrap": false,
}
func defaultFileFormat() string {
if runtime.GOOS == "windows" {
return "dos"
}
return "unix"
}
func GetInfoBarOffset() int {
offset := 0
if GetGlobalOption("infobar").(bool) {

View File

@ -157,7 +157,7 @@ Here are the available options:
an effect if the file is empty/newly created, because otherwise the fileformat
will be automatically detected from the existing line endings.
default value: `unix`
default value: `unix` on Unix systems, `dos` on Windows
* `filetype`: sets the filetype for the current buffer. Set this option to
`off` to completely disable filetype detection.