CARVIEW |
Select Language
HTTP/2 200
date: Wed, 30 Jul 2025 15:23:30 GMT
content-type: text/html; charset=utf-8
vary: X-PJAX, X-PJAX-Container, Turbo-Visit, Turbo-Frame, X-Requested-With,Accept-Encoding, Accept, X-Requested-With
etag: W/"4741098bb7ab5232fb29031e34babe6a"
cache-control: max-age=0, private, must-revalidate
strict-transport-security: max-age=31536000; includeSubdomains; preload
x-frame-options: deny
x-content-type-options: nosniff
x-xss-protection: 0
referrer-policy: origin-when-cross-origin, strict-origin-when-cross-origin
content-security-policy: default-src 'none'; base-uri 'self'; child-src github.githubassets.com github.com/assets-cdn/worker/ github.com/assets/ gist.github.com/assets-cdn/worker/; connect-src 'self' uploads.github.com www.githubstatus.com collector.github.com raw.githubusercontent.com api.github.com github-cloud.s3.amazonaws.com github-production-repository-file-5c1aeb.s3.amazonaws.com github-production-upload-manifest-file-7fdce7.s3.amazonaws.com github-production-user-asset-6210df.s3.amazonaws.com *.rel.tunnels.api.visualstudio.com wss://*.rel.tunnels.api.visualstudio.com objects-origin.githubusercontent.com copilot-proxy.githubusercontent.com proxy.individual.githubcopilot.com proxy.business.githubcopilot.com proxy.enterprise.githubcopilot.com *.actions.githubusercontent.com wss://*.actions.githubusercontent.com productionresultssa0.blob.core.windows.net/ productionresultssa1.blob.core.windows.net/ productionresultssa2.blob.core.windows.net/ productionresultssa3.blob.core.windows.net/ productionresultssa4.blob.core.windows.net/ productionresultssa5.blob.core.windows.net/ productionresultssa6.blob.core.windows.net/ productionresultssa7.blob.core.windows.net/ productionresultssa8.blob.core.windows.net/ productionresultssa9.blob.core.windows.net/ productionresultssa10.blob.core.windows.net/ productionresultssa11.blob.core.windows.net/ productionresultssa12.blob.core.windows.net/ productionresultssa13.blob.core.windows.net/ productionresultssa14.blob.core.windows.net/ productionresultssa15.blob.core.windows.net/ productionresultssa16.blob.core.windows.net/ productionresultssa17.blob.core.windows.net/ productionresultssa18.blob.core.windows.net/ productionresultssa19.blob.core.windows.net/ github-production-repository-image-32fea6.s3.amazonaws.com github-production-release-asset-2e65be.s3.amazonaws.com insights.github.com wss://alive.github.com api.githubcopilot.com api.individual.githubcopilot.com api.business.githubcopilot.com api.enterprise.githubcopilot.com; font-src github.githubassets.com; form-action 'self' github.com gist.github.com copilot-workspace.githubnext.com objects-origin.githubusercontent.com; frame-ancestors 'none'; frame-src viewscreen.githubusercontent.com notebooks.githubusercontent.com; img-src 'self' data: blob: github.githubassets.com media.githubusercontent.com camo.githubusercontent.com identicons.github.com avatars.githubusercontent.com private-avatars.githubusercontent.com github-cloud.s3.amazonaws.com objects.githubusercontent.com release-assets.githubusercontent.com secured-user-images.githubusercontent.com/ user-images.githubusercontent.com/ private-user-images.githubusercontent.com opengraph.githubassets.com copilotprodattachments.blob.core.windows.net/github-production-copilot-attachments/ github-production-user-asset-6210df.s3.amazonaws.com customer-stories-feed.github.com spotlights-feed.github.com objects-origin.githubusercontent.com *.githubusercontent.com; manifest-src 'self'; media-src github.com user-images.githubusercontent.com/ secured-user-images.githubusercontent.com/ private-user-images.githubusercontent.com github-production-user-asset-6210df.s3.amazonaws.com gist.github.com; script-src github.githubassets.com; style-src 'unsafe-inline' github.githubassets.com; upgrade-insecure-requests; worker-src github.githubassets.com github.com/assets-cdn/worker/ github.com/assets/ gist.github.com/assets-cdn/worker/
server: github.com
content-encoding: gzip
accept-ranges: bytes
set-cookie: _gh_sess=OSTwykDX91nMV%2FHo%2BAGJxJ7xAyCpDeFlmU8EVYCNZ4nERS0278zpHEL7PUb1bYRHBqFDCyLmZyy0UAi7a%2F0rldzKVM6YIW%2Bm9ju5JFyYruS2T5IAK9cjdUXcocKQLiGl1UWQkXMCnb7ip%2B%2BecKT1lgqk5J1Hv0cP7R7O6GOS5vjLeLggrfBQJOSGOHqa%2BsDuJthyQ6OmaPW%2FTMf1DYVCeAHXWOPz%2FyHdGTFluTCllt59wMOsOW6iTdDtmYOz%2BF76J7GzwfsvH1TJqkjbVuN2fg%3D%3D--xlqugV%2FxQ%2FM95s8M--Y44UQbjyBucvNSpdu7%2F4mw%3D%3D; Path=/; HttpOnly; Secure; SameSite=Lax
set-cookie: _octo=GH1.1.1905718709.1753889010; Path=/; Domain=github.com; Expires=Thu, 30 Jul 2026 15:23:30 GMT; Secure; SameSite=Lax
set-cookie: logged_in=no; Path=/; Domain=github.com; Expires=Thu, 30 Jul 2026 15:23:30 GMT; HttpOnly; Secure; SameSite=Lax
x-github-request-id: E69C:2A4EE1:17D28:1C29D:688A38F2
Transient prompt for zsh (insipred by romkatv's powerlevel10k) · GitHub
Show Gist options
Save subnut/3af65306fbecd35fe2dda81f59acf2b2 to your computer and use it in GitHub Desktop.
{{ message }}
Instantly share code, notes, and snippets.
Last active
November 30, 2024 21:50
-
Star
10
(10)
You must be signed in to star a gist -
Fork
0
(0)
You must be signed in to fork a gist
-
Save subnut/3af65306fbecd35fe2dda81f59acf2b2 to your computer and use it in GitHub Desktop.
Transient prompt for zsh (insipred by romkatv's powerlevel10k)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Simple transient prompt | |
[[ -c /dev/null ]] || return | |
zmodload zsh/system || return | |
## Set the transient prompt PROMPT here - | |
TRANSIENT_PROMPT='%# ' # Sample value | |
function set_prompt { | |
## Set the values of PROMPT and RPROMPT here | |
# Sample values given below | |
PROMPT='%~'$'\n''%# ' | |
RPROMPT='%(?..%B%F{1}%?%f%b)' | |
} | |
zle -N send-break _transient_prompt_widget-send-break | |
function _transient_prompt_widget-send-break { | |
_transient_prompt_widget-zle-line-finish | |
zle .send-break | |
} | |
zle -N zle-line-finish _transient_prompt_widget-zle-line-finish | |
function _transient_prompt_widget-zle-line-finish { | |
(( ! _transient_prompt_fd )) && { | |
sysopen -r -o cloexec -u _transient_prompt_fd /dev/null | |
zle -F $_transient_prompt_fd _transient_prompt_restore_prompt | |
} | |
zle && PROMPT=$TRANSIENT_PROMPT RPROMPT= zle reset-prompt && zle -R | |
} | |
function _transient_prompt_restore_prompt { | |
exec {1}>&- | |
(( ${+1} )) && zle -F $1 | |
_transient_prompt_fd=0 | |
set_prompt | |
zle reset-prompt | |
zle -R | |
} | |
(( ${+precmd_functions} )) || typeset -ga precmd_functions | |
(( ${#precmd_functions} )) || { | |
do_nothing() {true} | |
precmd_functions=(do_nothing) | |
} | |
precmd_functions+=_transient_prompt_precmd | |
function _transient_prompt_precmd { | |
TRAPINT() { zle && _transient_prompt_widget-zle-line-finish; return $(( 128 + $1 )) } | |
} | |
# vim: sw=0 ts=4 sts=4 et |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#### Transient prompt with transient newline before prompt | |
[[ -c /dev/null ]] || return | |
zmodload zsh/system || return | |
## Set the transient prompt PROMPT here - | |
TRANSIENT_PROMPT='%# ' # Sample value | |
function set_prompt { | |
## Set the values of PROMPT and RPROMPT here | |
# Sample values given below | |
PROMPT='%~'$'\n''%# ' | |
RPROMPT='%(?..%B%F{1}%?%f%b)' | |
} | |
typeset -g _transient_prompt_newline= | |
function _transient_prompt_set_prompt { | |
set_prompt | |
PROMPT='$_transient_prompt_newline'$PROMPT | |
}; _transient_prompt_set_prompt | |
zle -N clear-screen _transient_prompt_widget-clear-screen | |
function _transient_prompt_widget-clear-screen { | |
_transient_prompt_newline= | |
zle .clear-screen | |
} | |
zle -N send-break _transient_prompt_widget-send-break | |
function _transient_prompt_widget-send-break { | |
_transient_prompt_widget-zle-line-finish | |
zle .send-break | |
} | |
zle -N zle-line-finish _transient_prompt_widget-zle-line-finish | |
function _transient_prompt_widget-zle-line-finish { | |
(( ! _transient_prompt_fd )) && { | |
sysopen -r -o cloexec -u _transient_prompt_fd /dev/null | |
zle -F $_transient_prompt_fd _transient_prompt_restore_prompt | |
} | |
zle && PROMPT=$TRANSIENT_PROMPT RPROMPT= zle reset-prompt && zle -R | |
} | |
function _transient_prompt_restore_prompt { | |
exec {1}>&- | |
(( ${+1} )) && zle -F $1 | |
_transient_prompt_fd=0 | |
_transient_prompt_set_prompt | |
zle reset-prompt | |
zle -R | |
} | |
(( ${+precmd_functions} )) || typeset -ga precmd_functions | |
(( ${#precmd_functions} )) || { | |
do_nothing() {true} | |
precmd_functions=(do_nothing) | |
} | |
precmd_functions+=_transient_prompt_precmd | |
function _transient_prompt_precmd { | |
# We define _transient_prompt_precmd in this way because we don't want | |
# _transient_prompt_newline to be defined on the very first precmd. | |
TRAPINT() {zle && _transient_prompt_widget-zle-line-finish; return $(( 128 + $1 ))} | |
function _transient_prompt_precmd { | |
TRAPINT() {zle && _transient_prompt_widget-zle-line-finish; return $(( 128 + $1 ))} | |
_transient_prompt_newline=$'\n' | |
} | |
} | |
# vim: sw=0 ts=4 sts=4 et |
I've added another (simpler) version without the transient newline above the normal prompt
when I activate a virtual environment of python it does not appear in the prompt, how could it be solved?
@gmr458 Add ${VIRTUAL_ENV##*/}
to PROMPT
or RPROMPT
or TRANSIENT_PROMPT
, depending on where you want to show it.
I solved it with this:
function set_prompt {
if [[ -n "$VIRTUAL_ENV" ]]; then
PROMPT="(`basename \"$VIRTUAL_ENV\"`) "
else
PROMPT=''
fi
## Set the values of PROMPT and RPROMPT here
# Sample values given below
PROMPT='%~'$'\n''%# '
RPROMPT='%(?..%B%F{1}%?%f%b)'
}
how i can integrated it with spaceship theme ?
i solve it with change to this
## Set the transient prompt PROMPT here -
TRANSIENT_PROMPT='➜ ' # Sample value
function set_prompt {
## Set the values of PROMPT and RPROMPT here
# Sample values given below
PROMPT='$(spaceship_prompt)'
RPROMPT='$(spaceship_rprompt)'
}
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You can’t perform that action at this time.
Thanks a lot!