warpdotdev / Warp

Warp is a modern, Rust-based terminal with AI built in so you and your team can build great software, faster.
https://warp.dev
Other
21.08k stars 360 forks source link

powerlevel10k support #2851

Closed romkatv closed 1 year ago

romkatv commented 1 year ago

I'm the author and maintainer of powerlevel10k (a zsh theme). I see in the docs that Warp does not support powerlevel10k. Is there anything I can help you with?

I haven't used Warp but from other terminals with similar capabilities I gather that you need to annotate prompt and the command line with special escape codes. Powerlevel10k has built-in support for popular annotations. The right kind of annotation is enabled automatically based on the terminal (iTerm2, Kitty, VSCode, etc.). I could do the same for Warp but I would need to know what needs annotating. Perhaps you have a specification of the protocol?

Warp Internal (ignore) - linear-label:770f6576-d6c0-4e4f-a259-fc64b5156087

Arvindh-Mojo commented 1 year ago

after getting it to work.. i'm seeing difference in the right side prompts.

warp doesn't show the right-side prompts until the command is run. for example, the k8s context.. in iterm, as i start to type any k8s/helm cmds, the context becomes available which is super helpful but in wrap it wont show unless the cmd is run, sort of defeats the purpose. Is there some setting that needs to be updated in warp ?

image

image

Marcin-91 commented 1 year ago

not sure if this is going help everyone but i had the same problem. updated to latest p10k (1.19.0), did a bunch of stuffs including (CMD-P -> Honor PS1)but nothing worked unless i did exec zsh. warp wont start up with zsh + p10k. So i ended up, uninstalling both p10k & omz and re-did everything (backedup my zshrc). seems to be working fine. simply upgrading p10k and having warp do the stuff seem to be buggy unless you clean up everything and do it fresh.

I will try ;)

@Marcin-91 Did it work for you ? Unfortunately I couldn't make it work. Am I doing something wrong ?

When I try it, I promise to let you know ;)

technofreak commented 1 year ago

My p10k prompt in iTerm2

Screenshot 2023-06-26 at 10 22 50 am

My p10k prompt in Warp

Screenshot 2023-06-26 at 10 23 07 am

I had to just enable PS1 and restart Warp to get it working. I can see the Clock is missing but everything else seems to appear.

Thanks for collaborating to get this working 👍 🙇 ❤️

Twoody commented 1 year ago

i have p10k installed through zinit but new terminals in warp don't use it. running zsh will start a new subshell using p10k though – just new warp terminals won't use it. is there setting i'm supposed to configure to support this?

I have the same problem. I need to type exec zsh to p10k turn on. Can anyone help? Do we need to make some changes in .zshrc file?

EDIT: CMD-P -> Honor PS1 inside Warp application works!


Outdated Comment below:


@Marcin-91 's answer works , but it should be said that this dissables Warp blocks, which then defeats the purpose of Warp, imo.

I have yet to try a completely fresh install, as mentioned in other comments. Current setup is:

Lastest Warp (v0.2023.06.20.08.04.stable_03) zsh 5.9 (x86_64-apple-darwin22.0) And p10k at 79753faacb6dc511088cb0d136ec438873613932 commit.

claycoleman commented 1 year ago

What worked for me @Marcin-91 was doing CMD-P -> Honor PS1 ! p10k started appearing instantly after that

Twoody commented 1 year ago

+1 @claycoleman ty

zachbai commented 1 year ago

Yep, as @claycoleman mentioned, the "Honor user's custom prompt" setting must be enabled (this tells Warp to render your shell-specific prompt rather than Warp's native prompt).

Additionally, we have a couple fixes that'll make their way into a release soon: 1) @ajeetdsouza a fix for the right-side prompt rendering issue 2) @hossein-bakhtiari-revolut a fix for the rendering of unicode block chars that will (a) improve the rendering for p10k's "blurred" config and (b) improve vertical alignment. As @romkatv pointed out in an earlier comment, this involves special-casing those chars to be rendered natively rather than with the corresponding font glyphs.

Here's how my p10k prompt is rendered (with a right-side prompt and "blur" selected): image

romkatv commented 1 year ago

I scrolled through all bug reports here and most of them appear to be fixed on the screenshot in https://github.com/warpdotdev/Warp/issues/2851#issuecomment-1608098245. Great job!

There is still a minor rendering issue.

prompt

If you zoom in on the prompt, you'll see black gaps where indicated by the red arrows. Ideally, there should be no gaps in there.

A part of the right prompt is invisible because the terminal is apparently configured with identical hues for background and color 0. It's a good idea to make them distinct at least for the sake of testing. (It's a good idea in general to keep these colors distinct. If they are identical, you have one fewer color to work with as black background becomes indistinguishable from no background. This isn't much different from, say, green color being identical to the background color, which is obviously undesirable.)

Lastly, it's unclear whether the bug report from https://github.com/warpdotdev/Warp/issues/2851#issuecomment-1606233249 has been addressed. You can test it as follows:

  1. Use the same powerlevel10k config as on the screenshot above. Current time should be displayed in the right prompt (just like on the screenshot).
  2. Type POWERLEVEL9K_TIME_SHOW_ON_COMMAND=foo; p10k reload and press ENTER. Current time should disappear from the right prompt.
  3. Type foo without pressing ENTER. Current time should appear in the right prompt. If it does not, this indicated that the bug reported by https://github.com/warpdotdev/Warp/issues/2851#issuecomment-1606233249 has not been fixed.

Edit: I forgot to mention the bug reported by multiple users that causes the cursor to appear on the wrong line. It's unclear whether it's been fixed on the screenshot in https://github.com/warpdotdev/Warp/issues/2851#issuecomment-1608098245 because that screenshot doesn't show the cursor.

kirkryan commented 1 year ago

Thanks, everyone - working perfectly for me! I had to remove my previous installation of powerline10k using the instructions here and everything worked. Before that step, it would complain that powerlevel10k was out of date (even though it was freshly updated).

image
vorporeal commented 1 year ago

@romkatv In terms of there still being some gaps - the first set of changes for "native" glyph rendering are only targeting Unicode "block drawing" characters, not the "box drawing" characters. Definitely going to add those too, but taking things one step at a time. :)

marcosdipaolo commented 1 year ago

@zachbai @romkatv everything working nicely at this end:

image

There's only this extra line where the cursor should be next to the green > instead of in a new line below. But nothing serious, really happy it's working :)

gee4vee commented 1 year ago

The release notes for the latest version indicate that p10k is now supported but it's not loading the theme for me in Warp. The theme does load in iTerm2. I've configured it using oh my zsh. Is there anything specific that needs to be done to enable the theme in Warp?

zachbai commented 1 year ago

@gee4vee Have you enabled the 'Honor user's custom prompt' setting per https://github.com/warpdotdev/Warp/issues/2851#issuecomment-1608064909?

gee4vee commented 1 year ago

@zachbai that's what I was missing! Thanks!

clemcvlcs commented 1 year ago

Thanks guys for this awesome work, just found out that the p10k feature to show some context on right side (e.g the k8s current context), dynamically based on what you're typing is not working in Warp. This bug has already been identified in this comment but I did not see any acknowledge or response about this bug. I've followed the steps stated by @romkatv in this comment and the current time never appeared in the right prompt.

This feature working on iterm2 with the exact same zsh/p10k config This feat is great, on my side it's the only blocker left for using Warp

zachbai commented 1 year ago

@clemcvlcs @Arvindh-Mojo Unfortunately this is a side-effect of the way the Warp input editor is implemented -- Warp's input doesn't send each individual character to the shell; the full command is submitted to the shell when you press "enter". This means the shell doesn't receive the in-progress input buffer and won't output the dynamic right-prompt as you type. All's to say that this is unlikely to change anytime soon, but we're aware of the underlying issue (this also prevents full support for a tool like fzf, for instance).

rsalmei commented 1 year ago

Mine seems to put an additional newline at the end:

image

In iTerm2:

image
xavieraijon commented 1 year ago

Mine seems to put an additional newline at the end: image

In iTerm2: image

If you run this exec zsh, it fixes it for now, hopefully they fix this bug.

zachbai commented 1 year ago

@rsalmei @xavieraijon This is actually not a bug per se. Warp renders the prompt on it's own line (indeed different from other terminals). See this screenshot of Warp's native prompt, rendered on the line above the cursor: image

We do hear your feedback on the issue though and have a feature request for "same line prompt" that you can follow here: https://github.com/warpdotdev/Warp/issues/2304. There's no firm ETA for this at the moment but it's definitely on the roadmap.

rsalmei commented 1 year ago

Warp renders the prompt on it's own line

Thanks @zachbai, but why then an exec zsh does fix it?

EDIT: screenshots included, why does it change the cursor style?

image image
dehanjl commented 1 year ago

Thank you so much for all the hard work, great to see it working mostly now.

I've gotten around the multi-line input issue by disabling it in p10k, so a workaround until the proper feature is released.

image

However, now I have the small issue of the command not being next to the arrow when transient prompt is enabled in p10k. Is there any way to resolve this?

zachbai commented 1 year ago

@rsalmei running exec zsh effectively opts-out of Warp's integration, so you're dropped into a "normal" shell experience, at the expense of losing completions, block segmentation, etc. But it also allows the shell to render the prompt itself, which is why it renders on the same line like other more traditional terminal emulators.

@dehan-jl The green arrow in the completed blocks is also a prompt -- so it is subject to the same newline issue.

mathomp4 commented 1 year ago

Query for @romkatv or other p10k/warp gurus here. How inadvisable is it to run two different p10k setups? That is, until #2304 is "fixed," could I:

if [[ $TERM_PROGRAM != "WarpTerminal" ]]; then
   [[ -f ~/.p10k.zsh ]] && source ~/.p10k.zsh
   unset ZLE_RPROMPT_INDENT

   source ~/.iterm2_shell_integration.zsh
else
   [[ -f ~/.p10k.zsh.oneline ]] && source ~/.p10k.zsh.oneline
fi

where if on Warp, I run a one-line prompt (which is really two lines, but, well, one less line), but in iTerm2 I run my normal two liner?

(And I now realize I should probably add a:

if [[ $TERM_PROGRAM == "iTerm.app" ]]

for that iterm2 integration...)

romkatv commented 1 year ago

@mathomp4 Sure, you can do that. You can also add an if or two to ~/.p10k.zsh and have just one config. Both approaches are fine.

mathomp4 commented 1 year ago

@mathomp4 Sure, you can do that. You can also add an if or two to ~/.p10k.zsh and have just one config. Both approaches are fine.

Well I feel a bit dumb. Just took a look and, yep, there's like two lines different between the two configs. Sigh. 😄

fcarboneras commented 1 year ago

Hello together,

P10K works great so far with the known issues, but i don't know if this issue is allready discussed.

At the right side, when i have insert and executed a command, the Warp options for that command block are hidden behind the right side from P10K.

is there a possibility to fix this ?

image

When i hover over the buttons they appears above the P10K design.

dannyneira commented 1 year ago

@Frittenfred97 The buttons show up only when you hover over a block, we implemented a background to the buttons so they won't overlap with the right prompt or very long prompts. This was a bit of a tradeoff we had to make when supporting rprompt so we hope you'll understand. As a workaround, you can use CMD-UP/DOWN to navigate/highlight the blocks and not trigger the block buttons.

Scott-J-McMullan commented 1 year ago

Hi @dehan-jl,

How exactly did you fix that issue in p10k? I'm having the same. Screenshot 2023-07-13 at 11 20 21

dehanjl commented 1 year ago

@Scott-J-McMullan so what I ended up doing is setting up two configurations using p10k configure, one for Warp and one for other terminals. For my Warp configuration, I set the "Prompt Height" option to one line, as Warp effectively injects its own newline. I then set the correct p10k configuration in my .zshrc by checking if the active terminal is Warp. Hopefully Warp will support multi-line prompts Soon™.

Scott-J-McMullan commented 1 year ago

@dehan-jl Nice one, thanks mate

pmbanugo commented 1 year ago

For me the problem is I don't see the features enabled until I run exec zsh

Scott-J-McMullan commented 1 year ago

@pmbanugo have you turned on Honor user's custom prompt (PS1) & set zsh as your startup shell? Screenshot 2023-07-18 at 08 06 37

pmbanugo commented 1 year ago

This worked perfect, thanks! I didn't need to change the startup shell because my default is zsh.

chandrakanthkannam commented 1 year ago

Hi Everyone, I'm running this version of Warp terminal v0.2023.08.15.08.03.stable_00 and my p10k settings only shows up when i run exec zsh once entered in to my terminal

image

and i dont see Honor user's custom prompt setting in my version,

image

can someone help me here?

Scott-J-McMullan commented 1 year ago

@chandrakanthkannam I think they have moved the setting. Go to Settings > Appearance > Prompt & make sure that Shell prompt (PS1) is selected. Screenshot 2023-08-18 at 13 32 50

chandrakanthkannam commented 1 year ago

Thanks @Scott-J-McMullan , I was able to get that running now.

AhnafS commented 1 year ago

Besides dong exec zsh is there no other way to solve the new line issue? exec zsh eliminates some of the features of Warp that I want to try out

kzana commented 1 year ago

Hi Everyone, I have issue with Warp + ZSH + p10k rainbow style: like you can see in the screenshot below all my segments separators have a dark background color.

Screenshot 2023-08-21 at 12 36 42

I didnt found any variable config to configure it in p10k.zsh file. Note that it's the same for all segment styles (tangled, angled, rounded) and that Im using Meslo font.

Someone maybe familiar with such issue ?

Thanks.

romkatv commented 1 year ago

@kzana Probably https://github.com/warpdotdev/Warp/issues/2851#issuecomment-1605005256

kzana commented 1 year ago

@kzana Probably #2851 (comment)

Thanks I missed it !

vtu-dog commented 1 year ago

Hello, I noticed that executing a command with a right-side prompt causes it to flicker: it jumps to the very edge of the window, then quickly readjusts its position. Just run any command that will throw a non-zero exit code, then click enter repeatedly. Anybody else facing the same issue?

EDIT Actually, holding enter causes problems as well, p10k control sequences such as ^[i^P enter the terminal input and are being interpreted as actual commands.

elviskahoro commented 1 year ago

Gonna close this out since it's mostly working. We can open up new issues for follow up improvements.

Cliffback commented 11 months ago

Hi. I just tried to install Warp, coming from iTerm. When using Powerlevel10k, the arrows are colored different than than the block it is coming from, which is really irritating. Is there some way of fixing this? Screenshot 2023-10-30 at 14 57 50

romkatv commented 11 months ago

@Cliffback https://github.com/warpdotdev/Warp/issues/2851#issuecomment-1605005256

Cliffback commented 11 months ago

@Cliffback #2851 (comment)

Thank you! :D

tfactor2 commented 7 months ago

Query for @romkatv or other p10k/warp gurus here. How inadvisable is it to run two different p10k setups? That is, until #2304 is "fixed," could I:

if [[ $TERM_PROGRAM != "WarpTerminal" ]]; then
   [[ -f ~/.p10k.zsh ]] && source ~/.p10k.zsh
   unset ZLE_RPROMPT_INDENT

   source ~/.iterm2_shell_integration.zsh
else
   [[ -f ~/.p10k.zsh.oneline ]] && source ~/.p10k.zsh.oneline
fi

where if on Warp, I run a one-line prompt (which is really two lines, but, well, one less line), but in iTerm2 I run my normal two liner?

(And I now realize I should probably add a:

if [[ $TERM_PROGRAM == "iTerm.app" ]]

for that iterm2 integration...)

I solved the problem by adding

if [[ $TERM_PROGRAM != "WarpTerminal" ]]; then
  POWERLEVEL9K_LEFT_PROMPT_ELEMENTS+=(newline)
  POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS+=(newline)
fi

to the bottom of ~/.p10k.zsh

qorbani commented 7 months ago

For my case, I needed to remove Prompt and a new line, so I did this in my .zshrc to make it compatible between iTerm and Warp using one p10k.zsh file.

[[ ! -f ~/.p10k.zsh ]] || {
  source ~/.p10k.zsh
  if [[ $TERM_PROGRAM == "WarpTerminal" ]]; then
    POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(${POWERLEVEL9K_LEFT_PROMPT_ELEMENTS[1,-3]})
    POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(${POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS[1,-2]})
  fi
}

Warp: warp iTerm: iterm

aboqasem commented 6 months ago

After disabling the prompt_char from the prompt, is there a way to disable it from being printed on each command?

Screenshot 2024-03-24 at 9 06 19 AM
romkatv commented 6 months ago

It looks like you've enabled Transient Prompt. You can turn it off via the configuration wizard or by editing ~/.p10k.zsh: https://github.com/romkatv/powerlevel10k/blob/da9b03777c4f2390c7e3f5c720ee4689336f811b/config/p10k-lean.zsh#L1683

aboqasem commented 6 months ago

It looks like you've enabled Transient Prompt. You can turn it off via the configuration wizard or by editing ~/.p10k.zsh: romkatv/powerlevel10k@da9b037/config/p10k-lean.zsh#L1683

Thanks! Thought there would be something to disable it completely, but this looks good as well.

Screenshot 2024-03-24 at 9 29 53 PM