在tmux内部使用nvim时,Neovim配色方案看起来不正确

lmvvr0a8  于 2022-12-13  发布在  其他
关注(0)|答案(4)|浏览(289)

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

Below is what it should look like

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

iaqfqrcu

iaqfqrcu1#

找到解决方案。这篇文章帮助我:https://cyfyifanchen.com/neovim-true-color/

set-default colorset-option -ga terminal-overrides ",xterm-256color:Tc"
insrf1ej

insrf1ej2#

.tmux.conf中的set-option -ga terminal-overrides ",xterm-256color:Tc".bashrc中的alias tmux="TERM=screen-256color-bce tmux"在windows WSL2中使用windows终端为我工作。现在我可以在tmux中使用vim:)

mtb9vblg

mtb9vblg3#

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
dhxwm5r4

dhxwm5r44#

我在neovim中运行了h: checkhealth,当我在一个tmux会话中使用neovim时,我只得到了一个错误消息。checkhealth消息为我提供了唯一有效的解决方案。
它是这样说的:

- 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'

相关问题