What does %F mean and how can I stop it meaning it

rxvtzsh

On an rxvt-clone (I'm using rxvt-unicode but it seems to happen on plain, old rxvt as well), the sequence of characters %F seems to have some sort of special meaning (as do a few others, such as %S). In particular, I get the following:

% date +%F          
38;5;0m2011-04-02
% date +%F--%H.%M.%S
38;5;0m--.Hostname.2011-04-02--22.25.59

with the text after the m being in some dark almost-black colour. Due to my colour scheme (mauve text on a dark blue polka dot background), this is almost unreadable.

What is this, and more importantly, how do I get it to stop?

To show why it is particularly annoying, my lecture documents have the date as part of their name. It is therefore quite convenient to be able to write:

xelatex lecture.beamer.$(date +%F).tex

since I can store that in my history and recall it with a few judicious TABs. However, the ensuing output is all the inverse of a whiter shade of pale, making it hard to see if there's an error.

In case it makes a difference, my shell is zsh.

Best Answer

In one of your comments, you mentioned using zsh with a preexec function that calls print -P $2.

In zsh, print -P accepts these format characters:

  • %F means set the foreground color
  • %S means set the standout attribute

See zsh prompt expansion for the full list.

So it's probably best to remove the -P flag from your call to print in preexec.

One way to get the same effect:

settitle() {
    printf "%b%s%b" "\033]0;" "$1" "\007"
}

tildedir() {
    print -Pn "%~" 
}

preexec() {
    settitle "$(tildedir):$2"
}