diff --git a/segment-virtualenv.go b/segment-virtualenv.go index 5bfec98..083c038 100644 --- a/segment-virtualenv.go +++ b/segment-virtualenv.go @@ -17,12 +17,15 @@ func segmentVirtualEnv(p *powerline) []pwl.Segment { env = strings.TrimSuffix(env, ") ") } if env == "" { - env, _ = os.LookupEnv("VIRTUAL_ENV") - if env != "" { - cfg, err := ini.Load(path.Join(env, "pyvenv.cfg")) + venv, _ := os.LookupEnv("VIRTUAL_ENV") + if venv != "" { + cfg, err := ini.Load(path.Join(venv, "pyvenv.cfg")) if err == nil { env = cfg.Section("").Key("prompt").String() } + if env == "" { + env = venv + } } } if env == "" {