Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion internal/config/settings.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"os"
"path/filepath"
"reflect"
"runtime"
"strconv"
"strings"

Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion runtime/help/options.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down