mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-09-16 09:16:26 +02:00
fallback to vi when trying to edit file and no EDITOR/VISUAL is defined
This commit is contained in:
@@ -271,6 +271,11 @@ func editFile(g *gocui.Gui, filename string) (string, error) {
|
|||||||
if editor == "" {
|
if editor == "" {
|
||||||
editor = os.Getenv("EDITOR")
|
editor = os.Getenv("EDITOR")
|
||||||
}
|
}
|
||||||
|
if editor == "" {
|
||||||
|
if _, err := runCommand("which vi"); err == nil {
|
||||||
|
editor = "vi"
|
||||||
|
}
|
||||||
|
}
|
||||||
if editor == "" {
|
if editor == "" {
|
||||||
return "", createErrorPanel(g, "No editor defined in $VISUAL, $EDITOR, or git config.")
|
return "", createErrorPanel(g, "No editor defined in $VISUAL, $EDITOR, or git config.")
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user