[fix] override default config.Editor with $EDITOR env var even without config file

pull/93/head
Adam Tauber 7 years ago
parent 7c16d9db3c
commit 34509b049a

@ -109,6 +109,12 @@ var DefaultConfig = Config{
},
}
func init() {
if os.Getenv("EDITOR") != "" {
DefaultConfig.General.Editor = os.Getenv("EDITOR")
}
}
func LoadConfig(configFile string) (*Config, error) {
if _, err := os.Stat(configFile); os.IsNotExist(err) {
return nil, errors.New("Config file does not exist.")
@ -121,10 +127,6 @@ func LoadConfig(configFile string) (*Config, error) {
return nil, err
}
if os.Getenv("EDITOR") != "" {
conf.General.Editor = os.Getenv("EDITOR")
}
if conf.Keys == nil {
conf.Keys = DefaultKeys
} else {

Loading…
Cancel
Save