Powerlevel9k / powerlevel9k

Powerlevel9k was a tool for building a beautiful and highly functional CLI, customized for you. P9k had a substantial impact on CLI UX, and its legacy is now continued by P10k.
https://github.com/romkatv/powerlevel10k
MIT License
13.47k stars 947 forks source link

`dir` replaces `$HOME` anywhere in cwd, not just beginning #1150

Closed Wuestengecko closed 5 years ago

Wuestengecko commented 5 years ago

Describe Your Issue

The dir segment replaces $HOME anywhere in the current working directory's path, not just at the beginning.

screenshot

Have you tried to debug or fix it?

I just noticed this, and have not yet done anything in order to fix it.

The quick and easy fix for this is to change line 800 (or the segment's line 54 on next) to

... && current_path=${current_path/#$HOME/"~"}

(notice the # before $HOME). This will make above screenshot keep ~ instead of /root, but leave /mnt/root as-is.

Environment Information

This information will help us understand your configuration.

dritter commented 5 years ago

Good finding @Wuestengecko . Would you create a PR for that? That would be awesome!