Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Changing color of vim syntastic error window

Tags:

vim

syntastic

I have installed syntastic on VIM to help me show errors in PHP code however with the current colorscheme/setting I have to following colors: error line

As you can see it's very hard to read, I wonder if there is a way to change the color if this error window specifically.

like image 495
Martijn Smidt Avatar asked May 28 '15 08:05

Martijn Smidt


2 Answers

If this is only for the current selected item in the quickfix window, that's the Search highlight group on top of the normal quickfix highlighting. You then have to change either one; the Search group will affect search results in other windows, too.

If this is other / special Syntastic highlighting, you best look through all groups in the :hi output to find the bad one.

Overriding

Unless you want to completely switch your colorscheme, you can adapt individual highlight groups via :highlight commands after the :colorscheme command in your ~/.vimrc. Either :hi link to another predefined group, or provide your own ctermfg=... guifg=... etc. color definitions, as described by :help highlight-args.

like image 180
Ingo Karkat Avatar answered Oct 14 '22 06:10

Ingo Karkat


Syntastic doesn't change (nor cares about) highlighting of the error window. It's a plain quickfix window, with filetype qf. Looking at syntax/qf.vim, the default highlighting is this:

syn match   qfFileName      "^[^|]*" nextgroup=qfSeparator
syn match   qfSeparator     "|" nextgroup=qfLineNr contained
syn match   qfLineNr        "[^|]*" contained contains=qfError
syn match   qfError         "error" contained

hi def link qfFileName      Directory
hi def link qfLineNr        LineNr
hi def link qfError         Error

Thus, if you see the quickfix window in different colours than the main text, it's because your colour scheme has specifically intended it to look that way. You can override highlighting for qfFileName, qfSeparator, qfLineNr, and qfError to make it more readable, but the better solution IMO would be to use a less broken colour scheme.

Edit: Vim 8.0.641 and later has QuickFixLine.

like image 26
lcd047 Avatar answered Oct 14 '22 05:10

lcd047