zsh-users
 help / color / mirror / code / Atom feed
* Prompt truncating, redux
@ 2006-07-01 15:35 Timothy Stone
  2006-07-01 18:25 ` Bart Schaefer
  0 siblings, 1 reply; 3+ messages in thread
From: Timothy Stone @ 2006-07-01 15:35 UTC (permalink / raw)
  To: zsh-users

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

List,

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 '%<...<%/'

For example:

user@host [...seg1/seg2/seg3] % in tcsh might be set with:

     set prompt = "%n@%m %B[%b%c3%B]%b %% "
     set ellipsis

In zsh, I can get everything but the ellipsis to behave, e.g.,

%
% cd really/deep/path/to/resource
% print -rP '%n@%m %B[%b%3~%B]%b %# '
user@host [path/to/resource] %
%

My various uses of the truncation syntax can't give me the "ellipsis"  
I hope for... any hints? Maybe I'm fretting to much, but given some  
of the really complex options and sample paths I've seen, mine must  
be simple... right? :)

Thanks in advance,
Tim



- --
Timothy Stone   |    www dot petmystone dot com
Rising Sun, MD  |  tstone at petmystone dot com

"This Satan's drink [coffee] is so delicious...
  we shall cheat Satan by baptizing it."
  Pope Clement VIII (1592-1605)


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (Darwin)

iD8DBQFEppYvlNb2aYI3YNkRAhMmAJwLfpf7A18RQSmUSPh11+o+0sZ81wCdH4g3
lt3+lAEvMl3Y2G0GzSikG0s=
=7jEU
-----END PGP SIGNATURE-----


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Prompt truncating, redux
  2006-07-01 15:35 Prompt truncating, redux Timothy Stone
@ 2006-07-01 18:25 ` Bart Schaefer
  2006-07-02 14:38   ` Timothy Stone
  0 siblings, 1 reply; 3+ messages in thread
From: Bart Schaefer @ 2006-07-01 18:25 UTC (permalink / raw)
  To: zsh-users

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.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Prompt truncating, redux
  2006-07-01 18:25 ` Bart Schaefer
@ 2006-07-02 14:38   ` Timothy Stone
  0 siblings, 0 replies; 3+ messages in thread
From: Timothy Stone @ 2006-07-02 14:38 UTC (permalink / raw)
  To: Bart Schaefer; +Cc: zsh-users

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


On Jul 1, 2006, at 2:25 PM, Bart Schaefer wrote:

> 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 '%<...<%/'
>
>
> 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.

Perfect! Thank you. The `zsh' community is fantastic!

Tim

- --
Timothy Stone   |    www dot petmystone dot com
Rising Sun, MD  |  tstone at petmystone dot com

"This Satan's drink [coffee] is so delicious...
  we shall cheat Satan by baptizing it."
  Pope Clement VIII (1592-1605)


- --
Timothy Stone   |    www dot petmystone dot com
Rising Sun, MD  |  tstone at petmystone dot com

"This Satan's drink [coffee] is so delicious...
  we shall cheat Satan by baptizing it."
  Pope Clement VIII (1592-1605)


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (Darwin)

iD8DBQFEp9polNb2aYI3YNkRAtVOAJ9d3h0P1ukkDygu6JsRYYppgO6zRwCfTEYP
emdb87gPYd3QimO6wnOfRE4=
=BFNV
-----END PGP SIGNATURE-----


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2006-07-02 14:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-07-01 15:35 Prompt truncating, redux Timothy Stone
2006-07-01 18:25 ` Bart Schaefer
2006-07-02 14:38   ` Timothy Stone

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).