I have the following in my .bash_profile (from a similar question here:
PROMPT_COMMAND='pwd2=$(sed "s:\([^/]\)[^/]*/:\1/:g" <<<$PWD)' PS1='\u@\h:$pwd2\$ '
However, if the current directory is within a .dir (such as ~/.vim/bundle/) then the prompt just displays a .:
I would like it instead to retain 1 char for all dirnames unless it has a dot, in which case it would show two, like this:
Even better would be if I also have the home directory represented by a
~ like this: