I have the following in my .vimrc file:

hi clear SpellBad
hi SpellBad cterm=underline,bold ctermfg=196 ctermbg=NONE

To make misspelled words red. Vim makes them only underlined and bold, but not colored. They remain white, no matter what color I use for ctermfg. When I take away the bold or underlined, those disappear, showing that it does indeed read those values, but somehow simply doesn't want to make things colored.

My complete .vimrc file is:

" automatically install vim-plug if git is 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 | source $MYVIMRC

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

" ===== FUNCTIONALITY =====
Plug 'wlangstroth/vim-racket'
Plug 'MicahElliott/vrod'
Plug 'klen/python-mode'
Plug 'tpope/vim-sensible'
" Plug 'https://github.com/kovisoft/slimv.git'
Plug 'scrooloose/nerdtree'
Plug 'ervandew/supertab'
Plug 'tpope/vim-obsession'
Plug 'terryma/vim-multiple-cursors'

" ===== LANGUAGE SUPPORT =====
" Plug 'jtratner/vim-flavored-markdown'
" Plug 'tpope/vim-markdown'
Plug 'vim-pandoc/vim-pandoc-syntax'
Plug 'vim-pandoc/vim-pandoc'

Plug 'dhruvasagar/vim-table-mode'

" ===== SNIPPETS =====
Plug 'MarcWeber/vim-addon-mw-utils'
Plug 'tomtom/tlib_vim'
Plug 'garbas/vim-snipmate'
Plug 'honza/vim-snippets'

" ===== COLORSCHEMES =====
Plug 'chriskempson/vim-tomorrow-theme'
Plug 'tomasr/molokai'
Plug 'altercation/vim-colors-solarized'
Plug 'chriskempson/base16-vim'
Plug 'nickburlett/vim-colors-stylus'
Plug 'sickill/vim-monokai'
Plug 'tyrannicaltoucan/vim-quantum'
Plug 'hericks/vimicks'
Plug 'vim-scripts/kate.vim'
Plug 'AlessandroYorba/Despacio'
Plug 'josuegaleas/jay'
Plug 'mbbill/vim-seattle'
Plug 'jacoborus/tender.vim'
Plug 'NLKNguyen/papercolor-theme'

" ===== PARENS =====
Plug 'kien/rainbow_parentheses.vim'

" Add plugins to &runtimepath
call plug#end()

" ===== MY FUNCTIONS =====
function ActivateSyntaxHighlighting()
    syntax on
    syntax enable

function SetTabWidth(width, softorhard)
    set expandtab
    set smarttab
    let &g:tabstop = a:width
    let &g:shiftwidth = a:width
    let &g:showtabline = a:width
    let &g:softtabstop = a:softorhard

function SetMarkdownOptions()
    colorscheme quantum
    set background=light
    hi clear SpellBad
    hi SpellBad cterm=underline,bold ctermfg=196 ctermbg=NONE
    hi SpellCap cterm=underline,bold ctermfg=166 ctermbg=NONE
    syn match UrlNoSpell "\w\+:\/\/[^[:space:]]\+" contains=@NoSpell
    """ LANGUAGE
    set spelllang=de_de,en_us
    set spellfile=~/.vim/spell/master-thesis.utf-8.add
    """ KEYWORDS
    set iskeyword=38,42,43,45,47-57,60-62,_,@
    """ TABS
    call SetTabWidth(4, 1)
    "syn match myExCapitalWords +\<\w*[A-Z]\K*\>\|'s+ contains=@NoSpell

function SetRacketOptions()
    colorscheme molokai
    call SetTabWidth(2, 1)
    hi MatchParen cterm=bold ctermbg=none ctermfg=magenta

function SetPythonOptions()
    set iskeyword=38,42,43,45,47-57,60-62,_,@
    call SetTabWidth(4, 1)
    hi MatchParen cterm=bold ctermbg=none ctermfg=magenta

function KeyComboOptions()
    map q <Nop>
    nnoremap <Up> gk
    nnoremap <Down> gj
    nnoremap <F3> :noh<CR>
    vnoremap <silent> # :s/^/#/<cr>:noh<cr>
    vnoremap <silent> -# :s/^#//<cr>:noh<cr>
    noremap <c-s-up> ddkP
    noremap <c-s-down> ddp
    map <F8> :NERDTreeToggle<CR>
    noremap <c-t> :tabe<cr>
    noremap <c-s-i> G=gg
    inoremap <C-c> <Esc><Esc>

" ===== AUTOCOMMANDS =====
augroup pandoc_syntax
    au! BufNewFile,BufFilePRe,BufRead *.md set filetype=markdown.pandoc
augroup END

autocmd BufEnter,BufNewFile,TabEnter *.md call SetMarkdownOptions()
autocmd BufEnter,BufNewFile,TabEnter *.rkt call SetRacketOptions()
autocmd BufEnter,BufNewFile,TabEnter *.py call SetPythonOptions()

" ===== TABLES =====
let g:table_mode_corner_corner="+"
let g:table_mode_header_fillchar="="
let g:table_mode_align_char=":"

" ===== automatically change directory to the current file =====
set autochdir

" ===== LOCALE SETTINGS =====
set encoding=utf-8

" ===== WORD CHARACTERS =====
" german stuff
set iskeyword=38,42,43,45,47-58,60-62,_,@

" ===== FONT SETTINGS =====
set guifont=Inconsolatas\ LGC:h10

" ===== LINE BREAKS =====
set wrap linebreak nolist

" ===== COLORSCHEMES =====
set term=xterm
set t_Co=256
call ActivateSyntaxHighlighting()
set termguicolors
colorscheme quantum

" activate rainbow parentheses
"au VimEnter * RainbowParenthesesToggle
"au Syntax * RainbowParenthesesLoadRound
"au Syntax * RainbowParenthesesLoadSquare
"au Syntax * RainbowParenthesesLoadBraces

" ===== NERD TREE =====
" NerdTree automatically opened
" autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif

" ===== TABS =====
call SetTabWidth(4, 1)

filetype plugin on
set omnifunc=syntaxcomplete#Complete
filetype indent on

call KeyComboOptions()

" ===== SEARCH =====
set hlsearch

" ===== LINE NUMBERS  =====
set number

" ===== CURSOR =====
autocmd InsertEnter * set cul
autocmd InsertLeave * set nocul

" ===== MOUSE =====
"set mouse=n
"set ttymouse=xterm2

" ===== FOLDING =====
set foldmethod=indent   
set foldnestmax=10
set nofoldenable
set foldlevel=2

" ===== LANGUAGE =====
set spelllang=en_us
" set spelllang=de_de

I am only setting this when a markdown file is entered.

Additional Information

  • output of echo $TERM: xterm-256color
  • output of echo &t_Co: 256
  • output of :verbose :hi SpellBad:

    SpellBad       xxx cterm=bold,underline ctermfg=196
        Last set from ~/.vimrc
  • I figured something out when I disabled all the color settings in my vimrc and then checked for the value of :verbose :hi SpellBad. The setting then contains guifg and guibg values! However, I am not using gvim, but simply vim in the terminal, so I have no idea how that can be. If I set guifg, the setting is applied as it should have been with ctermfg. However, not all colors seem to work. For example I can use "words" like Red but not for example 196.


Why is Vim ignoring the color value, but does apply the bold and underline?

  • 1
    What is the output of :echo $TERM and :echo &t_Co?
    – romainl
    Nov 1, 2016 at 10:44
  • Try setting ctermbg. If I remember correctly, some groups have those values inverted
    – grodzik
    Nov 1, 2016 at 16:09
  • @romainl added that information @grodzik I just tried: as colors for both, ctermfg and ctermbg are ignored, while bold and underline still are accepted. Nov 1, 2016 at 17:34
  • what is the output of :verbose :hi SpellBad? Nov 1, 2016 at 17:54
  • @ChristianBrabandt added that as well. Even the color is mentioned, but it appears white instead Nov 1, 2016 at 18:05

1 Answer 1


If you use the termguicolors option you want to use the guifg and guibg attributes of the highlighting definitions. Because that is what this option efectively does: use rgb coloring in the terminal.

  • Yes, this indeed solved the problem. Made some stuff look strange, but that is because of the colorscheme itself and now ctermfg and ctermbg are working as I expected them to work. Nov 2, 2016 at 20:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.