Fix %(prompt) variable formatting

Without this patch, "%(prompt" (with a missing ending parenthesis) is
formatted and causes a segmentation fault.

For instance, `:!echo %(prompt`.