Add highlight groups for the signs and the lines.

This allows users to customize the coloring of Syntastic's signs, and
also provides them a way to highlight the entire line using :sign's
linehl feature.  It preserves the current default behavior of using
the error and todo highlight groups if the customized ones aren't
present.  If the linehl group doesn't exist, then it's the same as not
specifying one, so no special highlighting for the line will occur.
This commit is contained in:
John Szakmeister 2013-02-23 06:47:40 -05:00
parent 182b3f01c0
commit 10697a6952
2 changed files with 47 additions and 4 deletions

View File

@ -92,6 +92,30 @@ Syntastic uses the |:sign| commands to mark lines with errors and warnings in
the sign column. To enable this feature, use the |'syntastic_enable_signs'| the sign column. To enable this feature, use the |'syntastic_enable_signs'|
option. option.
Signs are colored using the Error and Todo syntax highlight groups by default.
If you wish to customize the colors for the signs, you can use the following
groups:
SyntasticErrorSign - For syntax errors, links to 'error' by default
SyntasticWarningSign - For syntax warnings, links to 'todo' by default
SyntasticStyleErrorSign - For style errors, links to 'SyntasticErrorSign'
by default
SyntasticStyleWarningSign - For style warnings, links to
'SyntasticWarningSign' by default
Example: >
highlight SyntasticErrorSign guifg=white guibg=red
<
To set up highlighting for the line where a sign resides, you can use the
following highlight groups:
SyntasticErrorLine
SyntasticWarningLine
SyntasticStyleErrorLine - Links to 'SyntasticErrorLine' by default
SyntasticStyleWarningLine - Links to 'SyntasticWarningLine' by default
Example: >
highlight SyntasticErrorLine guibg=#2f0000
<
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
2.3. The error window *:Errors* *syntastic-error-window* 2.3. The error window *:Errors* *syntastic-error-window*

View File

@ -274,10 +274,29 @@ endfunction
if g:syntastic_enable_signs if g:syntastic_enable_signs
"define the signs used to display syntax and style errors/warns "define the signs used to display syntax and style errors/warns
exe 'sign define SyntasticError text='.g:syntastic_error_symbol.' texthl=error' exe 'sign define SyntasticError text='.g:syntastic_error_symbol.' texthl=SyntasticErrorSign linehl=SyntasticErrorLine'
exe 'sign define SyntasticWarning text='.g:syntastic_warning_symbol.' texthl=todo' exe 'sign define SyntasticWarning text='.g:syntastic_warning_symbol.' texthl=SyntasticWarningSign linehl=SyntasticWarningLine'
exe 'sign define SyntasticStyleError text='.g:syntastic_style_error_symbol.' texthl=error' exe 'sign define SyntasticStyleError text='.g:syntastic_style_error_symbol.' texthl=SyntasticStyleErrorSign linehl=SyntasticStyleErrorLine'
exe 'sign define SyntasticStyleWarning text='.g:syntastic_style_warning_symbol.' texthl=todo' exe 'sign define SyntasticStyleWarning text='.g:syntastic_style_warning_symbol.' texthl=SyntasticStyleWarningSign linehl=SyntasticStyleWarningLine'
if !hlexists('SyntasticErrorSign')
highlight link SyntasticErrorSign error
endif
if !hlexists('SyntasticWarningSign')
highlight link SyntasticWarningSign todo
endif
if !hlexists('SyntasticStyleErrorSign')
highlight link SyntasticStyleErrorSign SyntasticErrorSign
endif
if !hlexists('SyntasticStyleWarningSign')
highlight link SyntasticStyleWarningSign SyntasticWarningSign
endif
if !hlexists('SyntasticStyleErrorLine')
highlight link SyntasticStyleErrorLine SyntasticErrorLine
endif
if !hlexists('SyntasticStyleWarningLine')
highlight link SyntasticStyleWarningLine SyntasticWarningLine
endif
endif endif
"start counting sign ids at 5000, start here to hopefully avoid conflicting "start counting sign ids at 5000, start here to hopefully avoid conflicting