2761e8685190a619e4ead80b04c39a6f94bfd7a1
[stack/conf/vim.git] / addons / TagHighlight / autoload / TagHighlight / SpecialHandlers.vim
1 " Tag Highlighter:
2 "   Author:  A. S. Budden <abudden _at_ gmail _dot_ com>
3 " Copyright: Copyright (C) 2009-2011 A. S. Budden
4 "            Permission is hereby granted to use and distribute this code,
5 "            with or without modifications, provided that this copyright
6 "            notice is copied with it. Like anything else that's free,
7 "            the TagHighlight plugin is provided *as is* and comes with no
8 "            warranty of any kind, either expressed or implied. By using
9 "            this plugin, you agree that in no event will the copyright
10 "            holder be liable for any damages resulting from the use
11 "            of this software.
12
13 " ---------------------------------------------------------------------
14 try
15         if &cp || v:version < 700 || (exists('g:loaded_TagHLSpecialHandlers') && (g:plugin_development_mode != 1))
16                 throw "Already loaded"
17         endif
18 catch
19         finish
20 endtry
21 let g:loaded_TagHLSpecialHandlers = 1
22
23 function! TagHighlight#SpecialHandlers#CRainbowHandler()
24         call TagHLDebug("Language handler for rainbow.vim compatibility", "Information")
25         if exists("b:hlrainbow") && ! exists("g:nohlrainbow")
26                 " Use a dictionary as a set (a unique item list)
27                 let hl_dict = {}
28                 for key in ["c","c++"]
29                         if has_key(g:TagHighlightPrivate['Kinds'], key)
30                                 for kind in values(g:TagHighlightPrivate['Kinds'][key])
31                                         let hl_dict[kind] = ""
32                                 endfor
33                         endif
34                 endfor
35                 let all_kinds = keys(hl_dict)
36                 for cluster in ["cBracketGroup","cCppBracketGroup","cCurlyGroup","cParenGroup","cCppParenGroup"]
37                         exe 'syn cluster' cluster 'add=' . join(all_kinds, ',')
38                 endfor
39         endif
40 endfunction
41
42 function! TagHighlight#SpecialHandlers#JavaTopHandler()
43         call TagHLDebug("Language handler for javaTop compatibility", "Information")
44         if has_key(g:TagHighlightPrivate['Kinds'], 'java')
45                 exe 'syn cluster javaTop add=' . join(values(g:TagHighlightPrivate['Kinds']['java']), ',')
46         endif
47 endfunction