vim 如何使gruvbox背景变黑?

798qvoo8  于 2022-11-11  发布在  其他
关注(0)|答案(3)|浏览(223)

我花了大约2个小时来寻找和弄清楚为什么我的背景颜色是灰色的...有人有线索吗?非常令人沮丧

syntax on

set guicursor=
set relativenumber
"set nohlsearch
set hidden
set noerrorbells
set tabstop=2 softtabstop=2
set shiftwidth=2
set expandtab
set smartindent
set nu
set nowrap
set smartcase
set noswapfile
set nobackup
set undodir=~/.vim/undodir
set undofile
set incsearch
set termguicolors
set scrolloff=8
set noshowmode
set completeopt=menuone,noinsert,noselect
set cursorline
set cursorcolumn
set splitright

" Give more space for displaying messages.
set cmdheight=2

" Having longer updatetime (default is 4000 ms = 4 s) leads to noticeable
" delays and poor user experience.
set updatetime=50

" Don't pass messages to |ins-completion-menu|.
set shortmess+=c

call plug#begin('~/.vim/plugged')

"Basic
Plug 'preservim/nerdtree'
Plug 'unkiwii/vim-nerdtree-sync'
Plug 'tpope/vim-fugitive'
Plug 'tpope/vim-surround'
Plug 'scrooloose/nerdcommenter'
Plug 'majutsushi/tagbar' "not working...
Plug 'vim-airline/vim-airline'
"Plug 'nathanaelkane/vim-indent-guides'
Plug 'Yggdroot/indentLine'
Plug 'airblade/vim-gitgutter'
Plug 'blueyed/vim-diminactive'
Plug 'mattn/emmet-vim'
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
Plug 'junegunn/fzf.vim'
Plug 'stsewd/fzf-checkout.vim'
Plug 'mileszs/ack.vim'

"Color Scheme"
Plug 'gruvbox-community/gruvbox'
"Plug 'dracula/vim', { 'as': 'dracula' }
Plug 'sheerun/vim-polyglot'
Plug 'colepeters/spacemacs-theme.vim'

"Plug 'sainnhe/gruvbox-material' "somehow this is laggy
"Plug 'phanviet/vim-monokai-pro'
Plug 'flazz/vim-colorschemes'
Plug 'chriskempson/base16-vim'

"lsp
Plug 'prabirshrestha/vim-lsp'
Plug 'mattn/vim-lsp-settings'

"auto-complete"
Plug 'neovim/nvim-lspconfig'
Plug 'nvim-lua/completion-nvim'
Plug 'nvim-lua/popup.nvim'
Plug 'nvim-lua/plenary.nvim'
Plug 'nvim-lua/telescope.nvim'
Plug 'nvim-lua/diagnostic-nvim'

"auto-linting
Plug 'dense-analysis/ale'

"vim game
Plug 'ThePrimeagen/vim-be-good'
Plug 'neoclide/coc.nvim', {'branch': 'release'}

" automatically clear search highlights after you move your cursor
Plug 'haya14busa/is.vim'

call plug#end()

"let g:dracula_colorterm = 0
"colorscheme dracula

"set colorcolumn=80

colorscheme gruvbox
highlight Normal ctermbg=0

set termguicolors
"highlight Normal ctermbg=none
"highlight NonText ctermbg=none
"highlight Normal guibg=black guifg=white
set background=dark
"highlight Normal ctermfg=black ctermbg=black
"highlight Normal ctermfg=grey ctermbg=darkblue

let loaded_matchparen = 1
let mapleader = " "

let g:lsp_diagnostics_echo_cursor = 1

let g:airline#extensions#tabline#enabled = 1
let g:airline#extensions#tabline#fnamemod = ':t'

let g:fzf_layout = { 'window': { 'window': 0.8, 'height': 0.8 } }
let $FZF_DEFAULT_OPTS='--reverse'

let g:completion_matching_strategy_list = ['exact', 'substring', 'fuzzy']
lua require'nvim_lsp'.tsserver.setup{ on_attach=require'completion'.on_attach }

inoremap <expr> <Tab>   pumvisible() ? "\<C-n>" : "\<Tab>"

let g:ale_fixers = {
      \'javascript': ['eslint'],
      \'json': ['prettier'],
      \'typescript': ['eslint'],
      \'typescriptreact': ['eslint'],
      \'markdown': ['prettier'],
      \'css': ['stylelint'],
      \'scss': ['stylelint']}
let g:ale_fix_on_save = 1
let g:ale_lint_on_text_changed = 'never'
let g:ale_lint_on_insert_leave = 0
let g:ale_lint_on_enter = 0

let g:NERDTreeHighlightCursorline = 1
let g:NERDTreeShowHidden=1
let g:NERDTreeAutoDeleteBuffer=1
let g:NERDTreeQuitOnOpen=0

...
lg40wkob

lg40wkob1#

let g:gruvbox_contrast_dark = 'hard'已修复此问题。
看起来对比度正常背景默认为灰色。

00jrzges

00jrzges2#

请尝试:

set bg=dark

那应该能解决问题

fcg9iug3

fcg9iug33#

要获得最黑的黑色(十六进制颜色代码#000000),请进入gruvbox.vim文件(我使用vim的本地包管理器so ~/.vim/pack/colorscheme/start/gruvbox/colors/gruvbox.vim),在“palate”下找到行:

let s:gb.dark0_hard =[#1d2021]

更改为

let s:gb.dark0_hard =[#000000]

在你的vimrc有行:

let g:gruvbox_contrast_dark='hard'
set background=dark
colorscheme gruvbox
hi Normal guibg=NONE ctermbg=NONE

保存,重新启动vim。享受
(You也可以使用相同的过程来定制gruvbox中的任何其他颜色。

相关问题