diff options
Diffstat (limited to 'repository')
-rw-r--r-- | repository/gogit.go | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/repository/gogit.go b/repository/gogit.go index 09f714ea..b907c070 100644 --- a/repository/gogit.go +++ b/repository/gogit.go @@ -5,6 +5,7 @@ import ( "fmt" "io/ioutil" "os" + "os/exec" stdpath "path" "path/filepath" "strings" @@ -231,7 +232,22 @@ func (repo *GoGitRepo) GetCoreEditor() (string, error) { return val, nil } - return "vi", nil + priorities := []string{ + "editor", + "nano", + "vim", + "vi", + "emacs", + } + + for _, cmd := range priorities { + if _, err = exec.LookPath(cmd); err == nil { + return cmd, nil + } + + } + + return "ed", nil } // GetRemotes returns the configured remotes repositories. |