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

Re: Help help, prompt problems here!



On May 8,  2:37pm, Fafa Hafiz Krantz wrote:
} 
} I am having some difficulty on one of the two boxes I installed
} zsh on today. The box having problems won't let no prompt appear
} unless I type CTRL+C. Even after I do that, it's not the prompt
} I've specified in /etc/zshrc.

As a general principle, you should be very careful of what you put into
the /etc/z* files, as opposed the $HOME/.z* files of each user.

For example:

} prompt elite2 green
} 
} if [[ `whoami` = root ]] then
} prompt elite2 red
} fi

This would be much better handled by placing "prompt elite2 red" in
~root/.zshrc and "prompt elite2 green" in ~fteg/.zshrc (or whatever
your non-root user account is, if it's not "fteg").

However, if you must test for root in /etc/z*, the best way is simply
to check with [[ $EUID = 0 ]] or even (( EUID == 0 )).

Returning to the original problem -- it seems likely that either (a)
there's something in /etc/zshenv that you're not telling us about, and
that something is stuck, possibly waiting for input, until you hit the
ctrl+c, or (b) `whoam` itself is stuck for some reason, and when you
hit ctrl+c it fails, so the "if" fails, so "prompt elite2 red" is not
executed.

You could find out which of these things is happening by placing a
"set -x" at the top of /etc/zshenv, or by running "zsh -x".

} Also, I need help modifying the theme 'elite2' into looking just
} a little bit better.

Find the prompt_elite2_setup file with this:

    print ${^fpath}/prompt_elite2_setup(N)

Copy that file to a new name in some directory in $fpath (it does not
have to be the same directory), such as prompt_fteg_setup -- the string
between the underscores is the theme name, so this is creating a new
theme named "fteg".

Edit prompt_fteg_setup and globally search-and-replace to change all
occurrences of "elite2" to "fteg".  Then find the assignment to PS1,
right in the middle of the prompt_fteg_setup function, and remove the
substring

    $parens($text%!$punctuation_color/$text%y$parens)$text

That'll leave you with two consective meta+d (0xc4) characters, of which
you should delete one.  I think it was bad form of the elite2 author to
leave raw non-ascii characters there, but the entire "for code in ..."
loop is extraneous as well ... it appears just to be sloppy or incomplete
copying from prompt_elite_setup.

Anyway, in that same long ugly assignment, the time is displayed with

    %D{%I:%M%P}

and the date with

    %D{%m/%d/%y}

you need to edit the stuff inside the { } to change the format.  See
"man strftime" for details.

Having finished with those edits and saved the file so that it's in
a directory in $fpath the next time zsh starts up, you should be able
to change "prompt elite2 green" to "prompt fteg green".



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