1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2024-11-26 09:00:57 +02:00

fallback to vi when trying to edit file and no EDITOR/VISUAL is defined

This commit is contained in:
Jesse Duffield 2018-08-11 16:55:05 +10:00
parent 6d4d6d3ac0
commit f0840c0f46

View File

@ -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.")
}