Commits

abudden committed 1e7f76e

Allow skipping of keywords on a per-project basis (fixes #7).

Comments (0)

Files changed (4)

autoload/TagHighlight/RunPythonScript.vim

 					endif
 				elseif option['Type'] == 'string'
 					let handled_options += [option['VimOptionMap']]
-					exe PY pyoption '= """'.a:options[option['VimOptionMap']].'"""'
+					exe PY pyoption '= r"""'.a:options[option['VimOptionMap']].'"""'
 				elseif option['Type'] == 'list'
 					let handled_options += [option['VimOptionMap']]
 					exe PY pyoption '= []'
 					for entry in a:options[option['VimOptionMap']]
-						exe PY pyoption '+= ["""' . entry . '"""]'
+						exe PY pyoption '+= [r"""' . entry . '"""]'
 					endfor
 				endif
 			endif

plugin/TagHighlight/data/options.txt

 	Type:string
 	Default:types
 	Help:Vim Types file prefix
+
+skip_patterns:
+	CommandLineSwitches:--add-skip-pattern
+	VimOptionMap:SkipPatterns
+	Type:list
+	Default:[]
+	Help:List of (Python) regular expressions to match against keywords which should be excluded from the types file.
  
 ctags_exe_full:
 	CommandLineSwitches:--ctags-exe-full-path

plugin/TagHighlight/module/generation.py

 from __future__ import print_function
 import os
+import re
 from .utilities import GenerateValidKeywordRange, IsValidKeyword
 
 vim_synkeyword_arguments = [
     # Add the ones not specified in priority
     allTypes += fullTypeList
 
+    patternREs = []
+    for pattern in options['skip_patterns']:
+        patternREs.append(re.compile(pattern))
+
     for thisType in allTypes:
         keystarter = 'syn keyword ' + thisType
         keycommand = keystarter
         for keyword in tags[thisType]:
+            skip_this = False
+            for pattern in patternREs:
+                if pattern.search(keyword) != None:
+                    skip_this = True
+                    break
+            if skip_this:
+                continue
+
             if options['check_keywords']:
                 # In here we should check that the keyword only matches
                 # vim's \k parameter (which will be different for different

plugin/TagHighlight/module/worker.py

 from __future__ import print_function
 import sys
 import os
-from .options import AllOptions
 
 def RunWithOptions(options):
     from .config import config, SetInitialOptions, LoadLanguages