Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Supporting %F{...} and %K{...} in Zsh 4.x



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: smime.p7s
Description: S/MIME Cryptographic Signature



Messages sorted by: Reverse Date, Date, Thread, Author