Text color on right of cursor #12

Closed
purplefish32 opened this Issue Dec 4, 2013 · 9 comments

10 participants

@purplefish32

On my install (zsh, terminator, crunchbang/debian) the text on the right is not grey, it is the same color as the left.
I dont know if this is a bug or if this is just my setup but its really annoying.

@dreadatour

You can define color with AUTOSUGGESTION_HIGHLIGHT_COLOR global variable. Default value is 'fg=8'.
You need to set this variable after plugin load (e.g. after line source ~/.zsh-autosuggestions/autosuggestions.zsh in your zsh config).

For example, here is my config:

source ~/.zsh-autosuggestions/autosuggestions.zsh
AUTOSUGGESTION_HIGHLIGHT_COLOR='fg=250'

zle-line-init() {
    zle autosuggest-start
}
zle -N zle-line-init
@pedro-nonfree

I have the same problem [working on debian wheezy 7.4 system]
@dreadatour I tried your config and is not working
(also with several fg values: 8, 128, 256, etc.)
suggestions are not grey! the text is like in the left and is confusing

zsh --version
zsh 4.3.17 (x86_64-unknown-linux-gnu)

oh-my-zsh recent
fishy theme
plugins=(git colorize colored-man zsh-syntax-highlighting)

@EliFinkelshteyn

Same problem here. Tried the config above, but still can't get the right to show up in a different color. Really frustrating. I'm on a mac (mavericks) running zsh 5.0.2 (x86_64-apple-darwin13.0). Tried deleting basically all else from my zshrc and still no go.

@mnapoli

+1, same here even with:

AUTOSUGGESTION_HIGHLIGHT_COLOR='fg=250'
@maksimr

Try AUTOSUGGESTION_HIGHLIGHT_COLOR="fg=cyan"

@pedro-nonfree

@maksimr: thanks for this answer!

other colors you can write:
man zshall search for fg=colour

Now, approximating to the fish colors:
sudo apt-get install colortest-python

run: $ colortest-python -n
only 8 color support no?

If you try to change fg from 0 to 7 it works. How to expand the number of colors?
Add to .zshrc this line:
export TERM="xterm-256color"

And now the colortest-python shows you a lot of colors:
Now, the default color works: AUTOSUGGESTION_HIGHLIGHT_COLOR="fg=8"

BUT it is not working with tty terminals (with no x server).
In that case, fish used another color, orange (fg=3). So know, we need to configure the color in different environments: tty and terminal emulator.

something like this:

if "terminal emulator in xserver" fg=8, else fg=3

I find in this article an example of this switch:
http://www.tldp.org/HOWTO/Bash-Prompt-HOWTO/x329.html

case $TERM in
    xterm*|rxvt*)
        #local TITLEBAR='\[\033]0;\u@\h:\w\007\]'
        AUTOSUGGESTION_HIGHLIGHT_COLOR="fg=8"
        ;;
    *)
        #local TITLEBAR=""
        AUTOSUGGESTION_HIGHLIGHT_COLOR="fg=3"
        ;;
esac

for fix this issue, the replacement should be this line https://github.com/tarruda/zsh-autosuggestions/blob/master/autosuggestions.zsh#L15 to:

case $TERM in
    xterm*|rxvt*)
        AUTOSUGGESTION_HIGHLIGHT_COLOR="fg=8"
        ;;
    *)
        AUTOSUGGESTION_HIGHLIGHT_COLOR="fg=3"
        ;;
esac

and here:
https://github.com/tarruda/zsh-autosuggestions/blob/master/README.mkd#zsh-autosuggestions
say that you need to add to .zshrc:
export TERM="xterm-256color"

Optionally, the if or case, could detect the number colors of the system (how to do that?), to switch between 8 and 3, or remain in 3. 3 is when you have 7 or 8 colors. And put in the FAQ: you always see orange suggestion? put export TERM="xterm-256color" in .zshrc.

Let's see how solves this problem @tarruda

@fboulay

Other way to solve this problem is to have the 256 zsh color plugin : https://github.com/chrissicool/zsh-256color

@uetchy

👍 solved this problem with changing xterm to xterm-256color.

@faceleg faceleg closed this Apr 20, 2015
@Marvel77

hey guys, I have mac os el capitan standart terminal and same issue, solved by setting terminal to xterm-256color and adding export ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE="fg=3" to the end of the .zshrc.
Just sharing in case it will help to somebody. Cheers!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment