powerlevel10k icon indicating copy to clipboard operation
powerlevel10k copied to clipboard

transient prompt customization

Open visigoth opened this issue 1 year ago • 2 comments

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.

visigoth avatar Feb 07 '25 18:02 visigoth

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 `

rwmitchell avatar Feb 07 '25 19:02 rwmitchell

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: https://github.com/romkatv/powerlevel10k/issues/2503.

romkatv avatar Feb 09 '25 10:02 romkatv