Base16和neovim。如何在linux VT和X终端中使用一致的颜色?

问题描述 投票:2回答:1

最近,我使用这个脚本使用base16配色方案配置了我的shell:https://github.com/chriskempson/base16-shell/blob/master/scripts/base16-default-dark.sh。和Neovim的配色方案使用:https://github.com/chriskempson/base16-vim

然后我在“.vimrc”或更准确地说.config/init/init.vim中设置了以下内容:

call plug#begin('~/.local/share/nvim/plugged')
Plug 'chriskempson/base16-vim'
...
set background=dark
let base16colorspace=256
colorscheme base16-default-dark

一切都工作得很好摘录我不能改变LineNumber列颜色,但这是另一个故事:

enter image description here

我意识到当我切换到VT(tty)时,我的颜色在Neovim中真的搞砸了。我看到VT或($ TERM = linux)仅支持8/16种颜色,而当我在$ TERM = screen / tmux / st(-256color)下时则不支持。所以base16-shell方案根据$ TERM以不同的方式应用颜色。所以问题是如何强迫Neovim(或颜色方案本身)意识到如何应用VT和X终端下的颜色?

shell vim vim-syntax-highlighting neovim
1个回答
6
投票

我有完全相同的问题。 iTerm2 + fish + nvim + tmux + fzf。 base16-shell和base16-vim的一切都很好用,但颜色在tmux下的nvim中搞砸了。花了两天时间弄明白了。以下两个tmux设置为我修复了它。

set -g  default-terminal "screen-256color"
# needed for proper nvim/tmux/base16 colors
set -ga terminal-overrides ",xterm-256color:Tc"

你可能想看看我的dotfiles

© www.soinside.com 2019 - 2024. All rights reserved.