Yes, it is possible to collapse directories to the path with the first unique letter, and the Z shell expands this path when you press [Tab]. I just used compinstall (the zsh script utility installed with Zsh) to generate the following code. The important part to take into account the extension of the path elements is in the sixth zstyle , near the end , where the character bracket for separating the termination points includes / , which, of course, is a directory separator. In this case, the unique paths that you proposed will be completely filled with one press of [Tab], as if * were at the end of each path name in unique letters.
# The following lines were added by compinstall zstyle ':completion:*' add-space true zstyle ':completion:*' completer _list _expand _complete _ignored _match _correct _approximate _prefix zstyle ':completion:*' completions 1 zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS} zstyle ':completion:*' matcher-list 'm:{[:lower:]}={[:upper:]} r:|[._-]=* r:|=*' 'm:{[:lower:]}={[:upper:]} m:{[:lower:][:upper:]}={[:upper:][:lower:]} r:|[._-]=* r:|=*' 'r:|[._-/]=* r:|=*' 'l:|=* r:|=*' zstyle ':completion:*' match-original both zstyle :compinstall filename '/home/micah/.zsh/.zshrc' autoload -Uz compinit compinit
As for creating a unique path in the first place and inserting it into the prompt, this is possible using a zsh script or function, and therefore should be possible for a full or linear editor, but just stick to the prompt you would add a function to the $precmd_functions which modifies or adds to the variable PS1 . This special array is a list of function names that run immediately before each prompt.
function precmd_unique_pwd { local pwd_string="$(upwd)" PS1="%B% n@ %m $pwd_string => %b" } precmd_functions+=( precmd_unique_pwd )
To get the current PWD in abbreviated form, I think this function is understandable and easy to use, although it is not necessarily optimized for low resource use.
#!/bin/zsh function upwd { emulate -LR zsh -o nullglob local dir Path local -a newpwd tmp stack local -i length=1 Flag=0 newpwd=( ${(s./.)PWD} ) foreach dir ( $newpwd ) (( length=0, Flag=0 )) repeat $#dir do (( length += 1 )) tmp=( ${(j.*/.)~stack}/$dir[1,$length]*(/) ) if (( $#tmp == 1 )) then Path=$Path/$dir[1,$length] stack+=( /$dir ) (( Flag=1 )) break fi done if (( Flag )) then continue else Path=$Path/$dir fi end print -- $Path } upwd
Note that it finds unique paths with directory names due to the Zsh (/) function at the end of globbing. In the last directory (current), this means that you can map something else if there is a file with the same name plus the extension.