zsh-users
 help / color / mirror / code / Atom feed
* Supporting %F{...} and %K{...} in Zsh 4.x
@ 2023-12-17 19:42 Grant Taylor
  2023-12-17 20:02 ` Roman Perepelitsa
  2023-12-17 21:32 ` Bart Schaefer
  0 siblings, 2 replies; 11+ messages in thread
From: Grant Taylor @ 2023-12-17 19:42 UTC (permalink / raw)
  To: zsh-users

[-- Attachment #1: Type: text/plain, Size: 2319 bytes --]

Hi,

Does anyone have any better ideas on how to support %F / %f and %K / %k 
in Zsh 4.2.5?

I'm trying to use a consistent profile ~> PROMPT across multiple 
versions of Zsh.  (Common ~/.zshrc which source OS and host specific 
files at the end.)  This angst comes from an ancient FreeBSD system 
that's still out to pasture.

The hack that I put in place on the machine specific file is to set 
PROMPT and RPROMPT to values of themselves with global substitutions.

The difference between ${...:/.../...} in 5.9 and ${...//.../...} in 4.2 
was unexpected, but I got around that.

Does anyone have any better idea(s)?

export PROMPT=${PROMPT//\%f/%{^[[39m%}}
export PROMPT=${PROMPT//\%F{black}/%{^[[30m%}}
export PROMPT=${PROMPT//\%F{red}/%{^[[31m%}}
export PROMPT=${PROMPT//\%F{green}/%{^[[32m%}}
export PROMPT=${PROMPT//\%F{yellow}/%{^[[33m%}}
export PROMPT=${PROMPT//\%F{blue}/%{^[[34m%}}
export PROMPT=${PROMPT//\%F{magenta}/%{^[[35m%}}
export PROMPT=${PROMPT//\%F{cyan}/%{^[[36m%}}
export PROMPT=${PROMPT//\%F{white}/%{^[[37m%}}

export PROMPT=${PROMPT//\%k/%{^[[39m%}}
export PROMPT=${PROMPT//\%K{black}/%{^[[30m%}}
export PROMPT=${PROMPT//\%K{red}/%{^[[31m%}}
export PROMPT=${PROMPT//\%K{green}/%{^[[32m%}}
export PROMPT=${PROMPT//\%K{yellow}/%{^[[33m%}}
export PROMPT=${PROMPT//\%K{blue}/%{^[[34m%}}
export PROMPT=${PROMPT//\%K{magenta}/%{^[[35m%}}
export PROMPT=${PROMPT//\%K{cyan}/%{^[[36m%}}
export PROMPT=${PROMPT//\%K{white}/%{^[[37m%}}

export RPROMPT=${RPROMPT//\%f/%{^[[39m%}}
export RPROMPT=${RPROMPT//\%F{black}/%{^[[30m%}}
export RPROMPT=${RPROMPT//\%F{red}/%{^[[31m%}}
export RPROMPT=${RPROMPT//\%F{green}/%{^[[32m%}}
export RPROMPT=${RPROMPT//\%F{yellow}/%{^[[33m%}}
export RPROMPT=${RPROMPT//\%F{blue}/%{^[[34m%}}
export RPROMPT=${RPROMPT//\%F{magenta}/%{^[[35m%}}
export RPROMPT=${RPROMPT//\%F{cyan}/%{^[[36m%}}
export RPROMPT=${RPROMPT//\%F{white}/%{^[[37m%}}

export RPROMPT=${RPROMPT//\%k/%{^[[49m%}}
export RPROMPT=${RPROMPT//\%K{black}/%{^[[40m%}}
export RPROMPT=${RPROMPT//\%K{red}/%{^[[41m%}}
export RPROMPT=${RPROMPT//\%K{green}/%{^[[42m%}}
export RPROMPT=${RPROMPT//\%K{yellow}/%{^[[43m%}}
export RPROMPT=${RPROMPT//\%K{blue}/%{^[[44m%}}
export RPROMPT=${RPROMPT//\%K{magenta}/%{^[[45m%}}
export RPROMPT=${RPROMPT//\%K{cyan}/%{^[[46m%}}
export RPROMPT=${RPROMPT//\%K{white}/%{^[[47m%}}

[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4033 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2023-12-24 18:37 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-17 19:42 Supporting %F{...} and %K{...} in Zsh 4.x Grant Taylor
2023-12-17 20:02 ` Roman Perepelitsa
2023-12-17 20:51   ` Grant Taylor
2023-12-18  6:57     ` Roman Perepelitsa
2023-12-20  5:50       ` Grant Taylor
2023-12-18 19:28     ` Bart Schaefer
2023-12-17 21:32 ` Bart Schaefer
2023-12-20  5:59   ` Grant Taylor
2023-12-20 16:58     ` Bart Schaefer
2023-12-24 18:25       ` Grant Taylor
2023-12-24 18:35         ` Bart Schaefer

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).