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
endif
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
endfunction
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
endfunction
function SetMarkdownOptions()
""" COLORSCHEME
colorscheme quantum
set background=light
""" SPELL CHECKING COLORS
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
endfunction
function SetRacketOptions()
colorscheme molokai
call SetTabWidth(2, 1)
hi MatchParen cterm=bold ctermbg=none ctermfg=magenta
endfunction
function SetPythonOptions()
set iskeyword=38,42,43,45,47-57,60-62,_,@
call SetTabWidth(4, 1)
hi MatchParen cterm=bold ctermbg=none ctermfg=magenta
endfunction
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>
endfunction
" ===== 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
" ===== RAINBOW PARENTHESES =====
" 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 containsguifg
andguibg
values! However, I am not usinggvim
, but simplyvim
in the terminal, so I have no idea how that can be. If I setguifg
, the setting is applied as it should have been withctermfg
. However, not all colors seem to work. For example I can use "words" likeRed
but not for example196
.
Question
Why is Vim ignoring the color value, but does apply the bold and underline?
:echo $TERM
and:echo &t_Co
? – romainl Nov 1 '16 at 10:44ctermbg
. If I remember correctly, some groups have those values inverted – grodzik Nov 1 '16 at 16:09ctermfg
andctermbg
are ignored, while bold and underline still are accepted. – Zelphir Kaltstahl Nov 1 '16 at 17:34:verbose :hi SpellBad
? – Christian Brabandt Nov 1 '16 at 17:54