To specify the number of trailing path components shown, insert an integer in the appropriate escape sequence at the prompt. In your case, %2~ will do the trick. Excerpt from zshmisc (1):
%d %/ Current working directory. If an integer follows the `%', it specifies a number of trailing components of the current working directory to show; zero means the whole path. A negative integer specifies leading components, ie %-1d specifies the first component. %~ As %d and %/, but if the current working directory starts with $HOME, that part is replaced by a `~'. Furthermore, if it has a named directory as its prefix, that part is replaced by a `~' followed by the name of the directory, but only if the result is shorter than the full path; see Dynamic and Static named directories in zshexpn(1).
source share