antony
antony

Reputation: 2997

(oh-my-)zsh's filename completion changes current font

I have just installed the (awesome) oh-my-zsh package to customize my zsh prompt, but I've hit this weird problem:

If I use autocompletion on a command name (e.g. sou<TAB> -> source), everything works as intended. However, if I use autocompletion on a file name (e.g. source .zshr<TAB> -> source .zshrc), the font changes to grey bold for the whole command. I do use bold in my PROMPT as well as colors, but not gray, so I don't know where that color code comes from; also the fact that it only happens when completing a file name puzzles me.

Here are my PROMPT and RPROMPT (inspired from Steve Losh's prose theme).

PROMPT='
%B%F{208}%n%{$reset_color%}%{$fg_bold[white]%}@%B%F{039}$(box_name)
%{$reset_color%}:%{$fg_bold[green]%}${PWD/#$HOME/~}%{$reset_color%}
$(hg_prompt_info)$(git_prompt_info)
$(virtualenv_info)$(prompt_char) '

RPROMPT='${return_status}%{$reset_color%}[%t]'

Thanks in advance.

Upvotes: 5

Views: 822

Answers (2)

antony
antony

Reputation: 2997

Actually, the solution was rather simple: color&weight changes introduces by %B and %F must be closed by %b and %f, not by $reset_color... that's all.

Upvotes: 6

ismail
ismail

Reputation: 265

Reset the colors just before closing the single quotes on both prompts; or you can also use %{^[[0m%} escape sequence. Note that ^[ is one character being the control-escape you can type it by first holding control and typing v then release and hit the escape key once.

Upvotes: 0

Related Questions