From f0840c0f4618427c3e2de33472d17bd46a50ad0f Mon Sep 17 00:00:00 2001 From: Jesse Duffield Date: Sat, 11 Aug 2018 16:55:05 +1000 Subject: [PATCH] fallback to vi when trying to edit file and no EDITOR/VISUAL is defined --- gitcommands.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/gitcommands.go b/gitcommands.go index d28263a60..6dbc41c28 100644 --- a/gitcommands.go +++ b/gitcommands.go @@ -271,6 +271,11 @@ func editFile(g *gocui.Gui, filename string) (string, error) { if editor == "" { editor = os.Getenv("EDITOR") } + if editor == "" { + if _, err := runCommand("which vi"); err == nil { + editor = "vi" + } + } if editor == "" { return "", createErrorPanel(g, "No editor defined in $VISUAL, $EDITOR, or git config.") }