From /usr/share/zsh/4.2.5/functions/Prompts/prompt_gentoo_setup: precmd () { prompt_gentoo_precmd } preexec () { } I don't know what exactly this is for, but it's *extremely frustrating*. If I do "prompt gentoo" before I redefine precmd and preexec in my zshrc then the prompt isn't set at all and I get the default prompt, and if I define it after then my precmd and preexec functions are overridden. Thanks, Tom
Sorry but I don't understand what you are talking about. If I do "prompt gentoo" before I redefine precmd and preexec, the redefined precmd/preexec are used; and if I define precmd and preexec before "prompt gentoo" then my precmd and preexec are overridden.
Hmm. Even if I trim down my zshrc to *just* the precmd/preexec and autoload -U promptinit; promptinit; prompt gentoo, then I get the same result: if I do prompt gentoo before I redefine precmd/preexec, I get the default prompt... hostname%.
Created attachment 58047 [details] prompt_gentoo_setup Now I understand what you mean. Does this fix your problem? You must call `prompt gentoo` before defining your precmd/preexec, but this should keep gentoo prompt when you have your own precmd/preexec. If this is okay I'll commit it to CVS.
Wonderful, this fixes it. Thank you! Tom
ok, it's in CVS ;)
Hmm, okay, this fixes the issue mentioned in the bug initiallity, but it creates a new one. The prompt is the same for root user as it is for ordinary user, that is, green and blue rather than red and blue.
It works well on my box (red and blue for root). Could you show me the instruction to reproduce your problem? mine: usata@rico ~ % su - rico root # zsh (<= red and blue, but bash) \[\033[01;31m\]\h \[\033[01;34m\]\W \$ \[\033[00m\]autoload -U promptinit \[\033[01;31m\]\h \[\033[01;34m\]\W \$ \[\033[00m\]promptinit \[\033[01;31m\]\h \[\033[01;34m\]\W \$ \[\033[00m\]prompt gentoo rico ~ # (<= red and blue)
Yeah, I take exactly the same steps: tmartin@pohl ~ % su Password: pohl tmartin # zsh (bash; red and blue) pohl# autoload -U promptinit (default zsh, white) pohl# promptinit pohl# prompt gentoo root@pohl tmartin # (green and blue) I have no .zshrc for root.
You need to append '-' in order to prevent new user's shell to inherit environment variables. usata@rico ~ % su - (<- you see, '-' is important) Now I understand what the problem is, and know how to revert back, but I think the current (new) behaviour is the right setting because if you do not append '-' almost all variables are inherited, including $HOME and $USER, so the prompt should also be inherited from previous user's. What do you think?
I understand :) I'm just going to have to tame my bad habits ;) Ready to RESOLVE? Thanks, Tom
Yup ;)