Skip to content

Commit

Permalink
fix: wrong aliasing when home is prefix of another folder
Browse files Browse the repository at this point in the history
  • Loading branch information
justjanne committed May 8, 2023
1 parent b736c08 commit d07d474
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion segment-cwd.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,13 @@ func cwdToPathSegments(p *powerline, cwd string) []pathSegment {
pathSeparator := string(os.PathSeparator)
pathSegments := make([]pathSegment, 0)

if strings.HasPrefix(cwd, p.userInfo.HomeDir) {
if cwd == p.userInfo.HomeDir {
pathSegments = append(pathSegments, pathSegment{
path: "~",
home: true,
})
cwd = ""
} else if strings.HasPrefix(cwd, p.userInfo.HomeDir+pathSeparator) {
pathSegments = append(pathSegments, pathSegment{
path: "~",
home: true,
Expand Down

0 comments on commit d07d474

Please sign in to comment.