Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Prompt truncating, redux



On Jul 1, 11:35am, Timothy Stone wrote:
}
} I figured out the expectations of zsh v. tcsh, save "set ellipsis"...  
} zsh seems to be able to do this, but I can't sort out the syntax  
} using '%<...<%/'

The ellipsis syntax in zsh truncates everything up to either the end
of the prompt or the next truncation marker.  It also truncates at a
set number of characters, rather than (e.g.) a set number of directory
levels in a path hierarchy.

So you can say

	%20<...<%/%<<

to get ellipsis followed by 20 characters of the tail of the path, but
that doesn't promise to show you three directories if the last one or
two are more than 20 characters long in total.

What you appear to want is conditional syntax, not truncation syntax:

	%4(c:...:)%3c

will show elipses if %c is at least 4 path elements long, nothing if it
is less than 4 elements long, followed by the last 3 elements of %c.



Messages sorted by: Reverse Date, Date, Thread, Author