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

Re: Fix strftime (prompts) before 5.2?



On Nov 22,  6:06pm, Peter Stephenson wrote:
}
} Putting it all together, the reported failing case is:
} 
} % (LC_ALL=de_CH.UTF-8; print -P "%D{%a %b %d} %D{%I:%M:%S%P}")
} Son Nov 22 

Maybe it's time (ahem) for something like this?  (Equivalent patch would
be needed in elite, elite2, fade, and fire themes.)

The difference is " %p" in most langinfo vs. "%P" in the current themes.


diff --git a/Functions/Prompts/prompt_bigfade_setup b/Functions/Prompts/prompt_bigfade_setup
index 2d95f31..918ac82 100644
--- a/Functions/Prompts/prompt_bigfade_setup
+++ b/Functions/Prompts/prompt_bigfade_setup
@@ -31,7 +31,10 @@ prompt_bigfade_setup () {
   autoload -Uz prompt_special_chars
   prompt_special_chars
 
-  PS1="%B%F{$fadebar}$schars[333]$schars[262]$schars[261]$schars[260]%B%F{$userhost}%K{$fadebar}%n@%m%b%k%f%F{$fadebar}%K{black}$schars[260]$schars[261]$schars[262]$schars[333]%b%f%k%F{$fadebar}%K{black}$schars[333]$schars[262]$schars[261]$schars[260]%B%F{$date}%K{black} %D{%a %b %d} %D{%I:%M:%S%P}$prompt_newline%B%F{$cwd}%K{black}%d>%b%f%k "
+  zmodload zsh/langinfo 2>/dev/null
+  local T_FMT=${${langinfo:+${langinfo[T_FMT_AMPM]}}:-%I:%M:%S%P}
+
+  PS1="%B%F{$fadebar}$schars[333]$schars[262]$schars[261]$schars[260]%B%F{$userhost}%K{$fadebar}%n@%m%b%k%f%F{$fadebar}%K{black}$schars[260]$schars[261]$schars[262]$schars[333]%b%f%k%F{$fadebar}%K{black}$schars[333]$schars[262]$schars[261]$schars[260]%B%F{$date}%K{black} %D{%a %b %d} %D{$T_FMT}$prompt_newline%B%F{$cwd}%K{black}%d>%b%f%k "
   PS2="%B%F{$fadebar}$schars[333]$schars[262]$schars[261]$schars[260]%b%F{$fadebar}%K{black}$schars[260]$schars[261]$schars[262]$schars[333]%F{$fadebar}%K{black}$schars[333]$schars[262]$schars[261]$schars[260]%B%F{$fadebar}>%b%f%k "
 
   prompt_opts=(cr subst percent)



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