Zsh-autosuggestions: Highlighting style not working in tmux.

Created on 4 Apr 2017  ·  8Comments  ·  Source: zsh-users/zsh-autosuggestions

Everything is ok when using zsh. The highlighting style of autosuggestions(I changed it to fg=240) works. But when I use tmux, the color of the suggestions did not change to what I expected(fg=240). The color is exactly the origin command line color. Other functions like right arrow key to complete or command line suggestions work well. There's only problem about highlighting styles in tmux. Any suggestion?

support

Most helpful comment

tmux default TERM is screen:

$ env | grep TERM
TERM=screen

You can solve it like this:

echo  "export TERM=xterm-256color" >> ~/.zshrc
exec zsh

All 8 comments

I'm experiencing the same issue. I've enabled set -g default-terminal screen-256color in .tmux.conf, but this doesn't help. When tmux is closed, everthing works fine.

Also experiencing this issue

tmux suggestion color

screen shot 2017-04-21 at 10 45 00 am

outside of tmux session

screen shot 2017-04-21 at 10 45 10 am

Note that issue is also occurring on the git zsh plugin inside of tmux

tmux default TERM is screen:

$ env | grep TERM
TERM=screen

You can solve it like this:

echo  "export TERM=xterm-256color" >> ~/.zshrc
exec zsh

If you use MacOS iTerm2, you may need to modify the terminal type.

MacOS iTerm2:

Preferences -> Profile -> Terminal -> Report Terminal Type :  xterm-256color

Sounds like this is solved. Thanks everyone 👍

Just came across another relevant link. See the tmux FAQ: https://github.com/tmux/tmux/wiki/FAQ#how-do-i-use-a-256-colour-terminal

Setting the default term to xterm-256color in your .tmux.conf does the trick:

# Set default term to xterm
set -g default-terminal xterm-256color

You can solve it like this:

echo  "export TERM=xterm-256color" >> ~/.zshrc
exec zsh

Thanks.
I made the block in .zshrc to make this only for tmux:

if [ ! "$TMUX" = "" ]; then export TERM=xterm-256color; fi

Was this page helpful?
0 / 5 - 0 ratings

Related issues

srajasimman picture srajasimman  ·  5Comments

moritzschaefer picture moritzschaefer  ·  5Comments

OmeGak picture OmeGak  ·  3Comments

mindyourlifeguide picture mindyourlifeguide  ·  6Comments

fgr0 picture fgr0  ·  3Comments