30

I'm trying to use vim-material theme from https://github.com/kaicataldo/material.vim

Below is what happens when i run neovim in tmux neovim in tmux

Below is what it should look like neovim not in tmux

What i've tried so far:

in my .tmux.conf I tried both

set -g default-terminal "screen-256color"

and

set -g default-terminal "xterm-256color"

I also tried

TERM=screen-256color-bce tmux

I am able to echo $TERM with proper results here. but i've also tried setting them manually with export TERM=xterm-256color or export TERM=screen-256color before i open nvim

This is what I have in my init.vim

let g:material_theme_style = 'ocean'
colorscheme material
set background=dark
set t_Co=256
set termguicolors

i've tried setting and unsetting these. unsetting termguicolors was the worst, the theme just didnt work and it gave me default vim look

I also run tmux as tmux -2 i should also mention i kill tmux sessions after changing anything in my tmux.conf to make sure it reflects

the versions of related apps and os

nvim v0.4.3
tmux 3.0a
iTerm2 3.3.9
macOS mojave 10.14.6

EDIT:

I've since tried clearing all tmux plugins and nvim plugins only leaving the default-terminal in my tmux config

Here's what's left on my init.vim file

call plug#begin('~/.config/nvim/plugged')

Plug 'kaicataldo/material.vim'
call plug#end()

set termguicolors
let g:material_theme_style = 'default'
colorscheme material

I also tried downloading an older version of tmux. 2.5, still no luck.

I deleted all my tmux plugins and nvim plugins and reinstalled material.vim so i'm sure nothing is conflicting in the plugins somehow

10 Answers 10

43

FOUND THE SOLUTION . this article helped me: https://www.cyfyifanchen.com/blog/neovim-true-color

set-default colorset-option -ga terminal-overrides ",xterm-256color:Tc"
Sign up to request clarification or add additional context in comments.

5 Comments

In tmux, set-default is an unknown command.
now it's instead: set-option -ga terminal-overrides ",xterm-256color:Tc"
omg thx so much!
~/.byobu/.tmux.conf
set xterm-256color to the value of $TERM when not in tmux if this doesn't work for you.
13

For me it worked like this, writing in .tmux.config

set -ga terminal-overrides ",xterm-256color:Tc"

1 Comment

I had to use this in conjuction with set -g default-terminal "tmux-256color" to get this to work (order didn't matter for me when I tested it). For good measure I sourced the config first, and then killed the tmux session completely.
12

I ran h: checkhealth in neovim and I was only getting an error message when I was using neovim inside a tmux session. The checkhealth message provided the only solution that worked for me.

This is what it said:

  - WARNING: Neither Tc nor RGB capability set. True colors are disabled. |'termguicolors'| won't work properly.
    - ADVICE:
      - Put this in your ~/.tmux.conf and replace XXX by your $TERM outside of tmux:
          set-option -sa terminal-overrides ',XXX:RGB'
      - For older tmux versions use this instead:
          set-option -ga terminal-overrides ',XXX:Tc'

Comments

7

Just change the TERM environment variable in your shell config file, in my case .zshrc, i.e:

# Path Variables
export TERM='xterm-256color'
export EDITOR='nvim'
export VISUAL='nvim'

Reload your terminal and reload tmux or kill tmux-server and check:

> echo $TERM

1 Comment

This is the only thing that worked for me from here.
4

set-option -ga terminal-overrides ",xterm-256color:Tc" in .tmux.conf and alias tmux="TERM=screen-256color-bce tmux" in .bashrc worked for me in windows WSL2 using windows terminal. now I can use vim within tmux :)

Comments

1

For me, setting the following in my ~/.bashrc helped:

export TERM='xterm-direct'

Of course, once you update your .bashrc, exit tmux and end all the tmux servers, then source ~/.bashrc, then start tmux again.

No need to add anything else in my ~/.tmux.conf.

Comments

1

For those who are looking for the solution if they are using "alacritty"..

set-option -g default-terminal "screen-256color"

set-option -a terminal-features ",alacritty:RGB"

nvim :checkhealth provides sufficient cue for the solution...

replace XXX by your $TERM outside of tmux

those who are not using alacritty, just run echo $TERM outside of tmux to find substitute for XXX

2 Comments

Thanks, I was going crazy, then I sorted SO answers and found your solution which works for me.
For info, just needs that set-option -a terminal-features "alacritty:RGB" (default-terminal is set to tmux-256color by default which works)
0

Since i use an old version of TMUX (that doesnt support all colors) this was my solution:

  -- Set colorscheme              
  vim.o.termguicolors = false               
  vim.cmd [[colorscheme default]] 

Comments

0

I've only added the following to alacritty.toml everything working perfectly now

[env]
TERM = "alacritty-direct"
  • Alacritty: 0.14.0 (22a4475)

  • MacOS: Sequoia

  • Tmux: 3.5a

  • Neovim: v0.10.4

Comments

0

I had the same error and couldn’t find a solution. By accident, while running LazyVim in Tmux, I checked the "LazyHealth" logs and noticed that "tmux" was not detecting "termguicolors," which gave me the solution. It was as simple as checking the terminal’s color settings by running echo $TERM in the default terminal (without Tmux). In my case, it was "xterm-256color". Then, in the .tmux.conf configuration file, I added the following line: set-option -a terminal-features 'XXX:RGB', where <XXX> should be replaced with your console’s color value, resulting in:

set-option -a terminal-features 'xterm-256color:RGB'

With that, I was able to fix the issue.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.