Open gegoune opened 2 years ago
hey @gegoune it seems like this transient prompt issue is similar to issue #1238
Transient prompt fails when line-finish hook gets added in precmd hook #1238
you can check it out, it may help you resolve the issue. Have a nice day :)
Thank you @prathikshetty2002. I did see those issues before submitting mine, don't think I could have deduct solution from them unfortunately, but since you think they might be similar I will revisit again.
Thanks! And you too have a nice day. )
Have you perchance made a typo where you wrote "transient prompt" instead of "instant prompt"?
Please post a complete set of zsh config that will allow me to reproduce this. Remove everything from then than can possibly be removed before posting them.
hey @gegoune it seems like this transient prompt issue is similar to issue #1238
Transient prompt fails when line-finish hook gets added in precmd hook #1238
you can check it out, it may help you resolve the issue. Have a nice day :)
That issue doesn't look similar.
hey @gegoune it seems like this transient prompt issue is similar to issue #1238
Transient prompt fails when line-finish hook gets added in precmd hook #1238
you can check it out, it may help you resolve the issue. Have a nice day :)
That issue doesn't look similar.
Oops yes now it doesn't look similar. I guess it was the typo this is a different issue .
Initially I thought that precmd
must be causing that issue — without it no extra characters were printed. I now think that I can keep precmd
in my configuration as long as it's not paired with https://github.com/sorin-ionescu/prezto/blob/master/modules/gnu-utility/init.zsh. (I am not using presto but copied that file over as I am on Mac but want to use GNU apps.)
So now, I am at the stage where I can deactivate either precmd
or aforementioned script and issue is gone.
I hope you will be able to reproduce it with:
if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
fi
source ${ZSH_PLUGIN_ROOT}/romkatv/powerlevel10k/powerlevel9k.zsh-theme
source ${ZSH_CONFIG}/components/p10k.zsh. # my p10k configuration file
# You can have either this…
source ${ZSH_CONFIG}/components/gnu-utility.zsh. # https://github.com/sorin-ionescu/prezto/blob/master/modules/gnu-utility/init.zsh
# or that, but not both.
# autoload -Uz add-zsh-hook
# function set-title {
# print -Pn "\e]1;test\a"
# }
# add-zsh-hook precmd set-title
@romkatv I figured that instead of using that utility script I can simply add relevant directories to PATH (homebrew installs no g
prefixed versions into directory like /usr/local/opt/coreutils/libexec/gnubin
). This solved the issue for me. I will leave itopen just in case you believe it is worth investigating further. Thank you very much!
Could you attach ${ZSH_CONFIG}/components/p10k.zsh.
so that I can reproduce this?
It's possible that the issue can be resolved by replacing print -Pn "\e]1;test\a"
with print -n '\e]1;test\a' >$TTY
. Please let me know if this works. Do attach the file I mentioned above even if it does.
Here it is:
t's possible that the issue can be resolved by replacing print -Pn "\e]1;test\a" with print -n '\e]1;test\a' >$TTY.
It does work. As in, title is set and no extra line printed above first prompt.
Given both solutions work, I hope you don't mind me asking, which way do you think is better? Should I keep using that utility tool from prezto or amend my PATH accordingly?
Given both solutions work, I hope you don't mind me asking, which way do you think is better?
You should definitely apply my suggested change. It has no downsides and makes your code more robust. Whether to use prezto or not, it's up to you.
Should I keep using that utility tool from prezto or amend my PATH accordingly?
If you change PATH
, you can use these tools from script. If you use functions, then you can use these tools only from interactive shell.
I did apply your suggestion - it was a fix as a matter of fact. Thank you very much.
And yes, you are right about interactive shell - did not think about it in those terms. I will change my PATH and remove that utility thing.
I am OK with that issue being closed now, unless you feel like there is anything to be done here.
I'll keep it open so that I don't forget to check why you had a problem in the first place. It should've worked without any change.
Hi @romkatv, been using your prompt for many years now, truly amazing, great thanks!
Never tried ~transient~ instant prompt before and after enabling it now I can definitely see the appeal. It works all good except for my
precmd
hook that I use to set window and tab titles:With that code in my
zshrc
line like- %
gets displayed above first prompt (pushing it down), but it's not there initially, I think it only appears after zsh finishes loading, I am not sure.https://user-images.githubusercontent.com/69750637/162136036-b7046bc6-26f8-4553-b8c7-b0db2e6257ac.mov
On this video I am opening new terminal tab.
Is that the right thing to do that? Would you be able to point me towards solution?
Thank you.
(apologies for submitting empty issue at first, hit enter by mistake, and wasn't sure if you would see I edited it since it got closed)