17

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

jdhao
  • 24,001
  • 18
  • 134
  • 273
Gene Sy
  • 1,325
  • 2
  • 10
  • 17

6 Answers6

25

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

set-default colorset-option -ga terminal-overrides ",xterm-256color:Tc"
Gene Sy
  • 1,325
  • 2
  • 10
  • 17
3

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 :)

joanis
  • 10,635
  • 14
  • 30
  • 40
iltoga
  • 31
  • 1
  • 2
3

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

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'
lesterfernandez
  • 216
  • 3
  • 7
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]] 
Koedlt
  • 4,286
  • 8
  • 15
  • 33
0

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

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