Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Highlighting style not working in tmux. #229

Closed
mtbehisseste opened this issue Apr 4, 2017 · 14 comments
Closed

Highlighting style not working in tmux. #229

mtbehisseste opened this issue Apr 4, 2017 · 14 comments
Labels

Comments

@mtbehisseste
Copy link

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?

@philippotto
Copy link

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.

@ghost
Copy link

ghost commented Apr 21, 2017

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

@mojidong
Copy link

tmux default TERM is screen:

$ env | grep TERM
TERM=screen

You can solve it like this:

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

@mojidong
Copy link

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

MacOS iTerm2:

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

@ericfreese
Copy link
Member

Sounds like this is solved. Thanks everyone 👍

@ericfreese
Copy link
Member

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

@ZhouShengsheng
Copy link

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

@crysis-ps
Copy link

crysis-ps commented Jan 28, 2020

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

iamsaywhat added a commit to iamsaywhat/.dotfiles that referenced this issue Aug 3, 2021
@vegerot
Copy link

vegerot commented Oct 26, 2021

However, I have read that

Tmux REALLY wants the terminal set to screen or screen-256color

Would this workaround perhaps break other things?

aming added a commit to aming/dotfiles that referenced this issue Jan 13, 2022
Fix zsh-autosuggestions highlighting stye not working in Tmux
ref: zsh-users/zsh-autosuggestions#229 (comment)
@afirth
Copy link

afirth commented Jun 30, 2022

Would this workaround perhaps break other things?

yes, neovim for example

@afirth
Copy link

afirth commented Jun 30, 2022

my workaround (gnome terminal) is

term prefs -> profiles -> show bold text in bright colors

and

.zshrc

zle_highlight=(default:bold)
# change color for solarized dark
export ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=60' # makes it light grey, non bold

no doubt you can do the first part in gconf if you like

this causes text in the terminal to be bold (and bright) and suggestions to be "normal"

@igloo1505
Copy link

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

MacOS iTerm2:

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

I know this is old, but in 2023 this still worked for me!

@DeepaPrasanna
Copy link

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

I have added this in .zshrc . this seems to not work for me. I have ubuntu 22.04

@a-pav
Copy link

a-pav commented Mar 15, 2024

Using TPM (Tmux Plugin Manger) and the tmux-sensible plugin is another fix for this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests