Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

transient prompt customization #2826

Open
visigoth opened this issue Feb 7, 2025 · 2 comments
Open

transient prompt customization #2826

visigoth opened this issue Feb 7, 2025 · 2 comments

Comments

@visigoth
Copy link

visigoth commented Feb 7, 2025

i'd like to customize the transient prompt a bit. i think the idiomatic way such customization could work for p10k is to specify the segments to capture at the time the command is accepted. p10k already does this somewhat by capturing exit code of the previous command and colors the prompt character red/green.

i'm thinking something like POWERLEVEL9K_TRANSIENT_PROMPT_SEGMENTS would capture the listed segments at the time the command is accepted and format it as left-handed segments for the transient prompt

my specific scenario is that i'd like to capture the time at which the command was run. i put the time in RIGHT_SEGMENTS for the interactive prompt, but would like to see the transient prompt format it on the left.

@rwmitchell
Copy link

Does setting POWERLEVEL9K_TIME_UPDATE_ON_COMMAND do this?
Or have a I completely misunderstood?

from my .p10k.zsh:

` ####################################[ time: current time ]####################################

Current time color.

typeset -g POWERLEVEL9K_TIME_FOREGROUND=0
typeset -g POWERLEVEL9K_TIME_BACKGROUND=7

Format for the current time: 09:51:02. See man 3 strftime.

typeset -g POWERLEVEL9K_TIME_FORMAT='%D{%H:%M:%S}'

If set to true, time will update when you hit enter. This way prompts for the past

commands will contain the start times of their commands as opposed to the default

behavior where they contain the end times of their preceding commands.

typeset -g POWERLEVEL9K_TIME_UPDATE_ON_COMMAND=true
`

@romkatv
Copy link
Owner

romkatv commented Feb 9, 2025

my specific scenario is that i'd like to capture the time at which the command was run. i put the time in RIGHT_SEGMENTS for the interactive prompt, but would like to see the transient prompt format it on the left.

There are many examples of transient prompt customization in the issues. You can search for "p10k-on-post-prompt" to see them. Here's one: #2503.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants