In zsh prompt_pwd use indexes rather than strings

otherwise if two directories in the heirarchy have the same name, they
will both not be shortened when one should be.

Also when shortening dir names, keep two letters when 1st is . (dot)

(I copied the prompt_pwd function into my own zsh, found it wasn't always working as intended and fixed it, so here are my fixes if you want them).