vim - colorscheme未正确设置背景颜色

ztmd8pv5  于 2022-11-24  发布在  其他
关注(0)|答案(2)|浏览(179)

我正在尝试为VIM设置nightowl主题,但它似乎部分呈现。语法颜色正确,但背景显示为黑色。
我的vimrc看起来像这样:

" automatic installation of vim-plug, if it's not available
if empty(glob('~/.vim/autoload/plug.vim'))
  silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
        \ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
  autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
endif

" plugins
call plug#begin('~/.vim/plugged')
Plug 'haishanh/night-owl.vim'
call plug#end()

if (has("termguicolors"))
  set termguicolors
endif

syntax enable
colorscheme night-owl

和:脚本名称

1: /usr/share/vim/vimrc
  2: ~/.vimrc
  3: ~/dotfiles/vim/plugins.vim
  4: ~/.vim/autoload/plug.vim
  5: /usr/share/vim/vim80/filetype.vim
  6: /usr/share/vim/vim80/ftplugin.vim
  7: /usr/share/vim/vim80/indent.vim
  8: /usr/share/vim/vim80/syntax/syntax.vim
  9: /usr/share/vim/vim80/syntax/synload.vim
 10: /usr/share/vim/vim80/syntax/syncolor.vim
 11: ~/dotfiles/vim/colors.vim
 12: /usr/share/vim/vim80/syntax/nosyntax.vim
 13: ~/.vim/plugged/night-owl.vim/colors/night-owl.vim
 14: /usr/share/vim/vim80/plugin/getscriptPlugin.vim
 15: /usr/share/vim/vim80/plugin/gzip.vim
 16: /usr/share/vim/vim80/plugin/logiPat.vim
 17: /usr/share/vim/vim80/plugin/manpager.vim
 18: /usr/share/vim/vim80/plugin/matchparen.vim
 19: /usr/share/vim/vim80/plugin/netrwPlugin.vim
 20: /usr/share/vim/vim80/plugin/rrhelper.vim
 21: /usr/share/vim/vim80/plugin/spellfile.vim
 22: /usr/share/vim/vim80/plugin/tarPlugin.vim
 23: /usr/share/vim/vim80/plugin/tohtml.vim
 24: /usr/share/vim/vim80/plugin/vimballPlugin.vim
 25: /usr/share/vim/vim80/plugin/zipPlugin.vim
 26: /usr/share/vim/vim80/ftplugin/vim.vim
 27: /usr/share/vim/vim80/indent/vim.vim
 28: /usr/share/vim/vim80/syntax/vim.vim
 29: /usr/share/vim/vim80/syntax/ruby.vim
 30: /usr/share/vim/vim80/syntax/python.vim

它应该是什么样子:night-owl-theme-vim
现在的情况:my-messed-up-night-owl-them

7gyucuyw

7gyucuyw1#

Nightowl使用以下背景定义:

hi Normal guifg=#d6deeb ctermfg=253 guibg=#011627 ctermbg=233 gui=NONE cterm=NONE

对我来说(在gnome-terminal中),终端背景值(233)也呈现为几乎漆黑的颜色。您可能希望通过复制:normal命令并将其放在:colorscheme之后,将该值调整为较浅的阴影(例如235)。
由于这仍然是一个索引的256色调色板,一些终端可能也允许改变Map到实际的RGB颜色。我想这也解释了你在截图中看到的差异。

bt1cpqcv

bt1cpqcv2#

默认情况下,Vim不启用XTerm RGB颜色(除非你使用的是gVim)。你必须手动设置它。把它放到你的.vimrc

syntax enable

if has('termguicolors')
    set termguicolors
    set t_Co=256

    " XTerm true colors
    let &t_8b = "\<Esc>[48;2;%lu;%lu;%lum"
    let &t_8f = "\<Esc>[38;2;%lu;%lu;%lum"
endif

colorscheme night-owl

相关问题