Blocking the agent mode of Cursor and Copilot.
When using the p10k theme with the agent mode of Cursor or Copilot, the agent can not get the information whether the previous command has been finished, and hence gets blocked. It will be solved by changing the theme to other themes, like agnoster. Any ideas to fix this?
This is rather Cursor's issue. As a workaround - I had to either enable ruler with
typeset -g POWERLEVEL9K_SHOW_RULER=true
or use horizontal line (similar to ruler) with
typeset -g POWERLEVEL9K_MULTILINE_FIRST_PROMPT_GAP_CHAR='·'
Note, cursor also has problem with multi-line output, see here https://github.com/getcursor/cursor/issues/3139#issuecomment-2921863716
@kopach Thanks for the response. However, I have tried both of them. They just do not work on my side :(
@shenmishajing same, unfortunately -g POWERLEVEL9K_SHOW_RULER=true didn't seem to do it for me. I wonder if I should try both or if its redundant.
Adding this to .zshrc worked for me, as this PAGER env variable is only set to this value when Cursor runs its agent terminal sessions. It keeps the powerlevel10k theme everywhere else.
if [[ "$PAGER" == "head -n 10000 | cat" ]]; then
ZSH_THEME="robbyrussell"
else
ZSH_THEME="powerlevel10k/powerlevel10k"
fi
@kstromeiraos are you on the latest version of cursor?
For me this just makes all zsh terminals (even manual ones) in cursor use the robbyrussel theme.
$PAGER and $CURSOR_TRACE_ID are supposed to only be set in agent mode but for me get set on every new terminal I create. Can verify by opening a zsh terminal in cursor then running printenv and I see them there
@TheBoroer $PAGER is always set, but in my case Cursor agent terminal sets it to head -n 10000 | cat (which is a different value to what other terminals use), so I'm using that value to identify when it's a Cursor agent tab. Using Cursor v1.0.1.
Ah good catch @kstromeiraos Weird but your zshrc snippet worked for me the second time I tried it 🤷 Thank you! 🥳
What is the purpose of piping the output of head to cat? Is it a different cat?
For my case (I'm using zsh4humans so switching zsh theme is out of my options), I look for $VSCODE_INSPECTOR_OPTIONS env and disable Instant Prompt
This way it works both in Cursor, and VSCode. I didn't use Windsurf but it should works, too.
if [[ -n "$VSCODE_INSPECTOR_OPTIONS" ]]; then
# Instant Prompt
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
fi
The downside is it also disables Instant Prompt within the editor's terminal but I can accept it I tested with prompting to let it run simple shell command. Before the fix there are no outputs accept the prompt since the Instant Prompt removes all output, I think
Adding this to
.zshrcworked for me, as thisPAGERenv variable is only set to this value when Cursor runs its agent terminal sessions. It keeps the powerlevel10k theme everywhere else.if [[ "$PAGER" == "head -n 10000 | cat" ]]; then ZSH_THEME="robbyrussell" else ZSH_THEME="powerlevel10k/powerlevel10k" fi
I can confirm that this solves the issue for me, since I'm using vscode copilot agent, I used this:
if [[ "$TERM_PROGRAM" == "vscode" ]]; then
# Simple theme so Copilot Agent detects command completion
ZSH_THEME="robbyrussell"
else
# Your normal fancy Powerlevel10k theme
ZSH_THEME="powerlevel10k/powerlevel10k"
fi
Just changed $PAGER to $TERM_PROGRAM.
Thanks for adding that @kstromeiraos!
Just for clarity and help other people searching on google for the same issue: I was having issues with vscode copilot agent when running commands, the command would run but the agent would hang loading forever.
The issue for me was Powerlevel10k confusing copilot agent command detection, switching to a simpler theme for those agent shells fixes it without sacrificing your normal zsh setup everywhere else.
In my case, Cursor is working fine but VSCode is still not working. It looks like Cursor may have changed to a basic shell that does not load .zshrc. To get VSCode working, I added the following check to my .zshrc to skip loading P10K when VSCode is making the call.
if [[ -z "$VSCODE_INJECTION" ]] && [[ -o interactive ]]; then
[[ -d "$HOME/.p10k" ]] && source "$HOME/.p10k/powerlevel10k.zsh-theme"
[[ -f "$HOME/.p10k.zsh" ]] && source "$HOME/.p10k.zsh"
fi