From a524b501734d72b6f65ee7beab55a842d722400a Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Thu, 21 Jun 2012 23:17:40 +0200 Subject: [PATCH] vimrc: Use additional syntax groups of my color scheme. --- vimrc | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/vimrc b/vimrc index 3b1ca66..8187c3b 100644 --- a/vimrc +++ b/vimrc @@ -88,6 +88,23 @@ if has('autocmd') endif +" HELPER FUNCTIONS + +" Check if the given syntax group is available. Thanks to bairui in #vim on +" Freenode (2012-02-19 01:15 CET) for the try/catch silent highlight idea. +if has('eval') + function! s:HasSyntaxGroup(group) + try + execute 'silent highlight ' . a:group + " \a = [A-Za-z] + catch /^Vim\%((\a\+)\)\=:E411/ " 'highlight group not found' + return 0 + endtry + return 1 + endfunction +endif + + " EDIT SETTINGS " Enable automatic file detection, plugin and indention support. @@ -527,7 +544,13 @@ if has('syntax') " from the Vim mailing list. It can easily be " disabled when necessary with :2match (in Vim >= 700). if !&diff && exists(':2match') - 2match Todo /\%>78v./ + " Use ColorColumn for overlong lines if available and my color + " scheme is used. + if &t_Co == 256 && HasSyntaxGroup('ColorColumn') + 2match ColorColumn /\%>78v./ + else + 2match Todo /\%>78v./ + endif elseif !&diff match Todo /\%>78v./ endif @@ -552,6 +575,11 @@ if has('syntax') execute ' for l:x in l:spaces' \ '| call matchadd("Error", "\\%u" . l:x)' \ '| endfor' + +" Reduce visibility of tabs in contrast to normal SpecialKeys. + if &t_Co == 256 && HasSyntaxGroup('specialKeyTab') + call matchadd('specialKeyTab', '\t') + endif endif endfunction " Enable highlights for the current and all new windows. Thanks to bairui in -- 2.45.2