Skip to content

Commit

Permalink
Merge pull request #1071 from twpayne/windows-default-editor
Browse files Browse the repository at this point in the history
Use notepad.exe, not vi, as the default editor on Windows
  • Loading branch information
twpayne committed Mar 18, 2021
2 parents 6e0f002 + 316371f commit e0143cd
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cmd/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -735,11 +735,11 @@ func (c *Config) editor() (string, []string) {
return c.Edit.Command, c.Edit.Args
}

// Prefer $VISUAL over $EDITOR and fallback to vi.
// Prefer $VISUAL over $EDITOR and fallback to the OS's default editor.
editor := firstNonEmptyString(
os.Getenv("VISUAL"),
os.Getenv("EDITOR"),
"vi",
defaultEditor,
)

// If editor is found, return it.
Expand Down
2 changes: 2 additions & 0 deletions cmd/util_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import (
"io"
)

const defaultEditor = "vi"

// enableVirtualTerminalProcessing does nothing.
func enableVirtualTerminalProcessing(w io.Writer) error {
return nil
Expand Down
2 changes: 2 additions & 0 deletions cmd/util_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import (
"golang.org/x/sys/windows"
)

const defaultEditor = "notepad.exe"

// enableVirtualTerminalProcessing enables virtual terminal processing. See
// https://docs.microsoft.com/en-us/windows/console/console-virtual-terminal-sequences.
func enableVirtualTerminalProcessing(w io.Writer) error {
Expand Down

0 comments on commit e0143cd

Please sign in to comment.