diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2018-08-11 16:55:05 +1000 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2018-08-11 16:55:05 +1000 |
commit | f0840c0f4618427c3e2de33472d17bd46a50ad0f (patch) | |
tree | b043dd5d0ac6022241d8fee9b408e2f63cc51ff4 | |
parent | 6d4d6d3ac05a11233520aa7158fbb390e739ffc9 (diff) |
fallback to vi when trying to edit file and no EDITOR/VISUAL is defined
-rw-r--r-- | gitcommands.go | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/gitcommands.go b/gitcommands.go index d28263a60..6dbc41c28 100644 --- a/gitcommands.go +++ b/gitcommands.go @@ -272,6 +272,11 @@ func editFile(g *gocui.Gui, filename string) (string, error) { 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.") } runSubProcess(g, editor, filename) |