]> ruderich.org/simon Gitweb - config/dotfiles.git/commitdiff
vimrc: Use additional syntax groups of my color scheme.
authorSimon Ruderich <simon@ruderich.org>
Thu, 21 Jun 2012 21:17:40 +0000 (23:17 +0200)
committerSimon Ruderich <simon@ruderich.org>
Thu, 21 Jun 2012 21:17:40 +0000 (23:17 +0200)
vimrc

diff --git a/vimrc b/vimrc
index 3b1ca66256af8e87d772eaf2dc6b94e533f3d804..8187c3bc61d491ecabbec62d8fbfe18b030388b4 100644 (file)
--- 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')
 " <antoine.mechelynck@gmail.com> 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 && <SID>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 && <SID>HasSyntaxGroup('specialKeyTab')
+                call matchadd('specialKeyTab', '\t')
+            endif
         endif
     endfunction
 " Enable highlights for the current and all new windows. Thanks to bairui in