我对我的配色方案如何与term
vim中的设置交互不完全了解,这妨碍了我使其在Neovim中正确显示的能力。
在我的.vimrc文件中,有关颜色方案的正确行为需要设置
set term=xterm
set t_Co=256
忽略这些设置中的任何一个都会导致颜色方案的显示不正确:
正确 不正确 不同不正确
该方案如下所示:
set background=dark
hi clear
if exists("syntax_on")
syntax reset
endif
let g:colors_name="impact3"
if exists("g:impact_transbg")
hi Normal ctermfg=255 ctermbg=none
hi NonText ctermfg=DarkGray ctermbg=none
hi Statement ctermfg=Blue ctermbg=none
hi Comment ctermfg=DarkGray ctermbg=none cterm=bold term=bold
hi Constant ctermfg=173 ctermbg=none
hi Identifier ctermfg=Cyan ctermbg=none
hi Type ctermfg=DarkGreen ctermbg=none
hi Folded ctermfg=0 ctermbg=235 cterm=underline term=none
hi Special ctermfg=Blue ctermbg=none
hi PreProc ctermfg=LightGray ctermbg=none cterm=bold term=bold
hi Scrollbar ctermfg=Blue ctermbg=none
hi Cursor ctermfg=white ctermbg=none
hi ErrorMsg ctermfg=Red ctermbg=none cterm=bold term=bold
hi WarningMsg ctermfg=Yellow ctermbg=none
hi VertSplit ctermfg=0 ctermbg=0
hi Directory ctermfg=Cyan ctermbg=DarkBlue
hi Visual ctermfg=White ctermbg=Gray cterm=underline term=none
hi Title ctermfg=255 ctermbg=Blue
hi String ctermfg=Blue ctermbg=none
hi StatusLine term=bold cterm=bold,underline ctermfg=White ctermbg=Black
hi StatusLineNC term=bold cterm=bold,underline ctermfg=Gray ctermbg=Black
hi LineNr term=bold cterm=bold ctermfg=2 ctermbg=None
hi Search ctermfg=Black ctermbg=2
hi TabLine ctermfg=0 ctermbg=DarkGray
hi TabLineFill ctermfg=DarkGray ctermbg=DarkGray
else
hi Normal ctermfg=White ctermbg=Black
hi NonText ctermfg=DarkGray ctermbg=Black
hi Statement ctermfg=Blue ctermbg=Black
hi Comment ctermfg=DarkGray ctermbg=Black cterm=bold term=bold
hi Constant ctermfg=DarkCyan ctermbg=Black
hi Identifier ctermfg=Cyan ctermbg=Black
hi Type ctermfg=DarkGreen ctermbg=Black
hi Folded ctermfg=DarkGreen ctermbg=Black cterm=underline term=none
hi Special ctermfg=Blue ctermbg=Black
hi PreProc ctermfg=LightGray ctermbg=Black cterm=bold term=bold
hi Scrollbar ctermfg=Blue ctermbg=Black
hi Cursor ctermfg=white ctermbg=Black
hi ErrorMsg ctermfg=Red ctermbg=Black cterm=bold term=bold
hi WarningMsg ctermfg=Yellow ctermbg=Black
hi VertSplit ctermfg=White ctermbg=Black
hi Directory ctermfg=Cyan ctermbg=DarkBlue
hi Visual ctermfg=White ctermbg=DarkGray cterm=underline term=none
hi Title ctermfg=White ctermbg=DarkBlue
hi StatusLine term=bold cterm=bold,underline ctermfg=White ctermbg=Black
hi StatusLineNC term=bold cterm=bold,underline ctermfg=Gray ctermbg=Black
hi LineNr term=bold cterm=bold ctermfg=White ctermbg=Black
endif
在neovim中,term
无法设置。我尝试使用手动设置的$ TERM调用neovim,如下所示:
TERM=xterm nvim
这样可以在常规vim中正确显示颜色(即等效于.vimrc中的设置术语),但是在neovim中,它看起来像这样:
为什么要在vim中产生该配色方案的正确显示set term=xterm
并进行set t_Co=256
必要的组合,为什么在neovim中等效的设置组合会产生不同的结果?
编辑:
默认值为 $TERM=xterm256-color
,出于某种原因,必须xterm
在常规vim中将其覆盖以使颜色正确显示。当环境变量的默认值为256时,neovim如下所示:
这与带有的常规vim相同xterm256-color
,但不符合预期。我的目标是了解为什么xterm hack在Vim中是必需/有效的,以及为什么它在neovim中看起来并不相同。
请注意,使用上述术语env变量设置可以正确显示许多颜色,值得注意的例外是行号和背景。我怀疑可能涉及此特定配色方案中指定颜色的方式。
set term=xterm
。