简体   繁体   中英

Comments have an ugly background color in vim solarized theme

My Configurations

iTerm2 - with Solarized theme with xterm-256color as Report terminal type .

zsh - with theme set to agnoster

Solarized vim - My vim theme is solarized, here're the settings:

set background=dark
let g:solarized_termcolors=16 "This fixed some issues i had of bg colors that was coming brown before
colorscheme solarized

Now all the colors are coming as expected expect the ugly comments that has a background color of dark grey (which i don't think is the default of this theme)

丑评论bgcolor截图

Note: I had oceanic theme before & the comment color issue actually happened after updating my vundle packages.

The following is my .vimrc file:

set nobackup          " get rid of anoying ~file
set encoding=utf-8

"Load up vundle
set nocompatible                  " don't need to be compatible with old vim
filetype off
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()

Plugin 'VundleVim/Vundle.vim'
Plugin 'mattn/emmet-vim'             " Emmet for html
Plugin 'evidens/vim-twig'            " Twig Syntax highlighting
Plugin 'hail2u/vim-css3-syntax'      " CSS3 Syntax
Plugin 'Solarized'
" Plugin 'mhartington/oceanic-next'    " Color Scheme

call vundle#end()
filetype plugin indent on
" load up pathogen and all bundles
" call pathogen#infect()
" call pathogen#helptags()

runtime macros/matchit.vim        " autoload that extends % functionality
syntax on                         " show syntax highlighting
set autoindent                    " set auto indent
set ts=2                          " set indent to 2 spaces
set shiftwidth=2
set softtabstop=2
set expandtab                     " use spaces, not tab characters
set relativenumber                " show relative line numbers
set showmatch                     " show bracket matches
set ignorecase                    " ignore case in search
set hlsearch                      " highlight all search matches
" set cursorline                    " highlight current line
set smartcase                     " pay attention to case when caps are used
set incsearch                     " show search results as I type
set ttimeoutlen=100               " decrease timeout for faster insert with 'O'
set vb                            " enable visual bell (disable audio bell)
set ruler                         " show row and column in footer
set scrolloff=2                   " minimum lines above/below cursor
set laststatus=2                  " always show status bar
set list listchars=tab:»·,trail:· " show extra space characters
set nofoldenable                  " disable code folding
set clipboard=unnamed             " use the system clipboard
set wildmenu                      " enable bash style tab completion
set wildmode=list:longest,full

" Color Scheme Settings
" set t_Co=256
set background=dark
let g:solarized_termcolors=16
colorscheme solarized
" set t_Co=256
" colorscheme OceanicNext
" set background=dark

" emmet key remap
imap <expr> <tab> emmet#expandAbbrIntelligent("\<tab>")
let g:cssColorVimDoNotMessMyUpdatetime = 1

" Current Directory remap
cnoremap <expr> %%  getcmdtype() == ':' ? expand('%:h').'/' :'%%'

" Set tabstop, softtabstop and shiftwidth to the same value
command! -nargs=* Stab call Stab()
function! Stab()
  let l:tabstop = 1 * input('set tabstop = softtabstop = shiftwidth = ')
  if l:tabstop > 0
    let &l:sts = l:tabstop
    let &l:ts = l:tabstop
    let &l:sw = l:tabstop
  endif
  call SummarizeTabs()
endfunction

function! SummarizeTabs()
  try
    echohl ModeMsg
    echon 'tabstop='.&l:ts
    echon ' shiftwidth='.&l:sw
    echon ' softtabstop='.&l:sts
    if &l:et
      echon ' expandtab'
    else
      echon ' noexpandtab'
    endif
  finally
    echohl None
  endtry
endfunction

if &term =~ '256color'
  " disable Background Color Erase (BCE) so that color schemes
  " render properly when inside 256-color tmux and GNU screen.
  set t_ut=
endif

Question

How I can make the comment color how it's suppose to be for this theme ? Something like this: 正确的评论风格 Is something else in my .vimrc messing it up ?

Run:

:hi Comment

It should return the colors applied for comments eg:

:hi Comment
Comment        xxx term=bold ctermfg=242

In your case you should also have:

ctermbg=value "where value != 0

So run:

:hi Comment ctermbg=0

This should turn off background colors for comments.

To add this to .vimrc:

hi Comment ctermbg=0

This problem occurs when I open my js file after I apply the colorsheme. There are ugly background color for comments and some of keywords like import so I don't like it.

What I did is :hi then hit enter, It will show all list of highlight name and its color. Choose the name you would like to change it. Here are an example for my case.

:hi jsComment cterm=NONE
:hi jsImport cterm=NONE
:hi jsFrom cterm=NONE

Hope this help.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM