Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: When RPROMPT != RPS1
- X-seq: zsh-workers 41350
- From: Daniel Tameling <tamelingdaniel@xxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: Re: When RPROMPT != RPS1
- Date: Fri, 23 Jun 2017 22:07:57 +0200
- Cc:
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=references:user-agent:from:to:cc:subject:in-reply-to:date :message-id:mime-version; bh=hJXvzOVOVIvnqBaCxom27bInso/zscRRF1F2RYHzUOU=; b=jB/KX6EULgTBgPkpZaMKnd4eSZh3W5u5WavtkunoLpvtsxJRevQSGkstQOih56jiAR 5M/YqjlUdqtvQEE5nGkN+iRyWmaHUSfS06uNbTeuGdiAgDpmIsL9/1yrPIAm12p7nhOq BdiG5HY1YXQ/YegcAWR84jdwyKig0r4G+fwlvEa+jmyse/JuhW4Yjum/JO5urJI9cIHi LtjshSFYGxkU7hENdebYs7kVk2xMr4oMIbbcxsDtt/9XiRjvZrHF2wNJGQLOivoKJVMn N42zooPcTbdL/JqyNvcqoL1jMxuemrdlq5NwiUpQ0lcRDk1IGt60ZO3SH1xoP9pOXDhV GnqQ==
- In-reply-to: <20170622101735.4ebebd11@pwslap01u.europe.root.pri>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <CA+rB6GJnFZDR6NQO1CwZx6d=QiD2=8nC3vKrNbm=am0s1SeZpA@mail.gmail.com> <CA+rB6GJmWTeRgQRr7OabGiENq=zWFOKHMGw6i43uuw82TrD_oQ@mail.gmail.com> <CGME20170621171640epcas3p3d782a0076de53dc91f1b78d3ec471af5@epcas3p3.samsung.com> <170621101645.ZM9838@torch.brasslantern.com> <20170622101735.4ebebd11@pwslap01u.europe.root.pri>
Peter Stephenson writes:
> On Wed, 21 Jun 2017 10:16:45 -0700
> Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
>> I don't have a good suggestion for how to satisfy both constraints.
>> Anyone? The parameter initialization code has been broken up into
>> a few more sections already, maybe there's a way to rearrange these
>> as well.
>
> We can at least make it less likely people are going to trip over the
> complications if they're simply using the prompt system.
>
> pws
If I understand the problem correctly, the issue is not just limited to
the right prompts. The different themes set different prompt variables,
so when you change between themes you get a prompt setup that depends on
the history of themes you used.
For example, if I do
autoload -Uz promptinit; promptinit
prompt clint
echo $PS3
I get
?#
But if I do
autoload -Uz promptinit; promptinit
prompt adam1
prompt clint
echo $PS3
I get
%K{blue}%n@%m%k %B%F{green}%147<...<%~
%}%F{white} ?# %b%f%k
Interestingly, there is no problem with the prompt functions like
precmd, preexec etc. as the configuration of the previously active theme
gets deleted in set_prompt right before the new theme is activated:
local hook
for hook in chpwd precmd preexec periodic zshaddhistory zshexit; do
add-zsh-hook -D "${hook}" "prompt_*_${hook}"
done
I think one solution for getting a consistent setup might be to add some
code at the same place that restores the prompt variables to their
default values.
Maybe something along the lines of what I included below (which seems to
solve the problem on my system). However, this breaks the bart theme as
it has a mode of operation where one can set the right prompt before
activating the theme.
Best,
Daniel
diff --git a/Functions/Prompts/promptinit b/Functions/Prompts/promptinit
index 587248997..0bc9b1ab4 100644
--- a/Functions/Prompts/promptinit
+++ b/Functions/Prompts/promptinit
@@ -160,6 +160,11 @@ Use prompt -h <theme> for help on specific themes.'
for hook in chpwd precmd preexec periodic zshaddhistory zshexit; do
add-zsh-hook -D "${hook}" "prompt_*_${hook}"
done
+ PS1='%m%# '
+ PS2='%_> '
+ PS3='?# '
+ PS4='+%N:%i> '
+ unset RPROMPT RPS1 RPROMPT2 RPS2
typeset -ga zle_highlight=( ${zle_highlight:#default:*} )
(( ${#zle_highlight} )) || unset zle_highlight
Messages sorted by:
Reverse Date,
Date,
Thread,
Author