Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Neovim losing colorscheme when in tmux. All past solutions I see don't work for me

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

like image 272
Gene Sy Avatar asked Feb 19 '20 21:02

Gene Sy


2 Answers

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

set-default colorset-option -ga terminal-overrides ",xterm-256color:Tc"
like image 73
Gene Sy Avatar answered Sep 28 '22 09:09

Gene Sy


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

like image 21
iltoga Avatar answered Sep 28 '22 07:09

iltoga