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

Re: volume label in prompt?

I use this:

precmd () {
 settitle "%n@m: %5(~:%-1~/…/%3~:%~)

Where settitle is a function that sets my window title. The %X(A:B:C) construct is zsh's ternary statement. What the above does is display paths with 1-3 elements whole, while longer paths have only the first and last three elements with the remainder replaced by an ellipsis.

If you use precmd you should be able to use any script you want to check the mount table, gather the mounted volume's label, etc.

Alex Satrapa

On 26/10/2012, at 11:57, TJ Luoma <luomat@xxxxxxxxx> wrote:

> On Thu, Oct 25, 2012 at 7:15 PM, Ray Andrews <rayandrews@xxxxxxxxxxx> wrote:
>> I'm now running three machines here, each with several copies of various
>> linii available.  It gets a bit confusing.  I'm wondering if there might be
>> something I can add to my prompt that could help me remind myself where I'm
>> at.  I'm open to any suggestions, but one idea I had was something to
>> identify the volume label of the current root directory.  That would do it
>> if it can be done. Can it?
> PROMPT="%n@%m %~: "
> n = username
> m = hostname up to first "."
> %~ is the current directory, using ~ for $HOME when appropriate.

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