Custom Oh My Zsh theme: long prompts disappear / cut off
Incidentally, your link is broken, highlighting one of the issues with posting a link to code instead of code itself - any future viewers of your question can't get a full picture.
I think your problem is that the 'color' characters you use should be escaped in a pair of %{...%}
:
%{...%}Include a string as a literal escape sequence. The string within the bracesshould not change the cursor position. Brace pairs can nest.
Using your latest commit on github, I don't see this issue - did you fix it? However, I'm seeing some issues with cursor placement and line-drawing, particularly with TAB
. When pressing TAB
, the cursor is moved up one line:
Pressed TAB here. Pressed TAB here.
The PROMPT
is being re-drawn 'up' one line every time. This is fixed by encapsulating the color codes within the %{...%}
:
# Solarized Dark colour schemeBOLD="%{$(tput bold)%}"RESET="%{$(tput sgr0)%}"SOLAR_YELLOW="%{$(tput setaf 136)%}"SOLAR_ORANGE="%{$(tput setaf 166)%}"SOLAR_RED="%{$(tput setaf 124)%}"SOLAR_MAGENTA="%{$(tput setaf 125)%}"SOLAR_VIOLET="%{$(tput setaf 61)%}"SOLAR_BLUE="%{$(tput setaf 33)%}"SOLAR_CYAN="%{$(tput setaf 37)%}"SOLAR_GREEN="%{$(tput setaf 64)%}"SOLAR_WHITE="%{$(tput setaf 254)%}"
I'm not 100% sure without the original ~/.zshrc
, but this should improve your prompt a little. :)
Apart from the orange, you can also use a terminal-based Solarized
profile and the zsh
colors
, which might be more portable. I couldn't get the orange right without tput
, though.
#autoload colors && colors#SOLAR_YELLOW="%{$fg[yellow]%}"#SOLAR_ORANGE="%{$(tput setaf 166)%}"#SOLAR_RED="%{$fg[red]%}"#SOLAR_MAGENTA="%{$fg[magenta]%}"#SOLAR_VIOLET="%{$fg_bold[magenta]%}"#SOLAR_BLUE="%{$fg[blue]%}"#SOLAR_CYAN="%{$fg[cyan]%}"#SOLAR_GREEN="%{$fg[green]%}"#SOLAR_WHITE="%{$fg[white]%}"