Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Make list of ignored syntax groups configurable

While trying to fix issue #20 I decided to refactor the code that
handles ignored syntax groups: Previously the list of excluded groups
was hard coded in two places, now it's a configuration option. Then
it turned out that including shFunction* in the list of excluded
syntax groups didn't fix the reported issue...
  • Loading branch information...
commit e3290ab006edf7c262a0bd117577043ce33435c6 1 parent 3d7e091
Peter Odding authored
4 README.md
View
@@ -159,6 +159,10 @@ If this is set and not false, it will suppress the warning on startup if ctags i
:let g:easytags_suppress_ctags_warning = 1
+### The `g:easytags_ignored_syntax_groups` option
+
+This variable is a string of comma separated names of syntax groups in which dynamic highlighting is not applied. It defaults to `.*String.*,.*Comment.*,cIncluded`.
+
## Faster syntax highlighting using Python
The Vim script implementation of dynamic syntax highlighting is quite slow on large tags files. When the Python Interface to Vim is enabled the easytags plug-in will therefor automatically use a Python script that performs dynamic syntax highlighting about twice as fast as the Vim script implementation. The following options are available to change the default configuration.
10 autoload/xolox/easytags.vim
View
@@ -1,9 +1,9 @@
" Vim script
" Author: Peter Odding <peter@peterodding.com>
-" Last Change: October 1, 2011
+" Last Change: October 29, 2011
" URL: http://peterodding.com/code/vim/easytags/
-let g:xolox#easytags#version = '2.7'
+let g:xolox#easytags#version = '2.7.1'
" Public interface through (automatic) commands. {{{1
@@ -315,8 +315,9 @@ function! xolox#easytags#highlight() " {{{2
" Convert matched tags to :syntax command and execute it.
call map(matches, 'xolox#misc#escape#pattern(get(v:val, "name"))')
let pattern = tagkind.pattern_prefix . '\%(' . join(xolox#misc#list#unique(matches), '\|') . '\)' . tagkind.pattern_suffix
- let template = 'syntax match %s /%s/ containedin=ALLBUT,.*String.*,.*Comment.*,cIncluded'
- let command = printf(template, hlgroup_tagged, escape(pattern, '/'))
+ let template = 'syntax match %s /%s/ containedin=ALLBUT,%s'
+ let command = printf(template, hlgroup_tagged, escape(pattern, '/'), xolox#misc#option#get('easytags_ignored_syntax_groups'))
+ call xolox#misc#msg#debug("easytags.vim %s: Executing command '%s'.", g:xolox#easytags#version, command)
try
execute command
catch /^Vim\%((\a\+)\)\=:E339/
@@ -677,6 +678,7 @@ function! s:highlight_with_python(syntax_group, tagkind) " {{{2
let context['prefix'] = get(a:tagkind, 'pattern_prefix', '')
let context['suffix'] = get(a:tagkind, 'pattern_suffix', '')
let context['filters'] = get(a:tagkind, 'python_filter', {})
+ let context['ignoresyntax'] = xolox#misc#option#get('easytags_ignored_syntax_groups')
" Call the Python function and intercept the output.
try
redir => commands
6 doc/easytags.txt
View
@@ -321,6 +321,12 @@ is not found or not recent enough.
>
:let g:easytags_suppress_ctags_warning = 1
+-------------------------------------------------------------------------------
+The *g:easytags_ignored_syntax_groups* option
+
+This variable is a string of comma separated names of syntax groups in which
+dynamic highlighting is not applied. It defaults to '.*String.*,.*Comment.*,cIncluded'.
+
===============================================================================
*easytags-faster-syntax-highlighting-using-python*
Faster syntax highlighting using Python ~
14 misc/easytags/highlight.py
View
@@ -5,7 +5,7 @@
generation in Python with a focus on doing the least amount of work.
Author: Peter Odding <peter@peterodding.com>
-Last Change: June 14, 2011
+Last Change: October 29, 2011
URL: http://peterodding.com/code/vim/easytags
'''
@@ -18,7 +18,7 @@
def easytags_ping():
print 'it works!'
-def easytags_gensyncmd(tagsfiles, filetype, tagkinds, syntaxgroup, prefix, suffix, filters):
+def easytags_gensyncmd(tagsfiles, filetype, tagkinds, syntaxgroup, prefix, suffix, filters, ignoresyntax):
# Get arguments from Vim.
if filters:
tagkinds = filters['kind']
@@ -43,13 +43,13 @@ def easytags_gensyncmd(tagsfiles, filetype, tagkinds, syntaxgroup, prefix, suffi
patterns.append(escaped)
counter += len(escaped)
if counter > limit:
- commands.append(_easytags_makecmd(syntaxgroup, prefix, suffix, patterns))
+ commands.append(_easytags_makecmd(syntaxgroup, prefix, suffix, patterns, ignoresyntax))
patterns = []
counter = 0
if patterns:
- commands.append(_easytags_makecmd(syntaxgroup, prefix, suffix, patterns))
+ commands.append(_easytags_makecmd(syntaxgroup, prefix, suffix, patterns, ignoresyntax))
return ' | '.join(commands)
-def _easytags_makecmd(syntaxgroup, prefix, suffix, patterns):
- template = r'syntax match %s /%s\%%(%s\)%s/ containedin=ALLBUT,.*String.*,.*Comment.*,cIncluded'
- return template % (syntaxgroup, prefix, r'\|'.join(patterns), suffix)
+def _easytags_makecmd(syntaxgroup, prefix, suffix, patterns, ignoresyntax):
+ template = r'syntax match %s /%s\%%(%s\)%s/ containedin=ALLBUT,%s'
+ return template % (syntaxgroup, prefix, r'\|'.join(patterns), suffix, ignoresyntax)
6 plugin/easytags.vim
View
@@ -1,6 +1,6 @@
" Vim plug-in
" Author: Peter Odding <peter@peterodding.com>
-" Last Change: September 26, 2011
+" Last Change: October 29, 2011
" URL: http://peterodding.com/code/vim/easytags/
" Requires: Exuberant Ctags (http://ctags.sf.net)
@@ -40,6 +40,10 @@ if !exists('g:easytags_ignored_filetypes')
let g:easytags_ignored_filetypes = '^tex$'
endif
+if !exists('g:easytags_ignored_syntax_groups')
+ let g:easytags_ignored_syntax_groups = '.*String.*,.*Comment.*,cIncluded'
+endif
+
if !exists('g:easytags_python_script')
let g:easytags_python_script = expand('<sfile>:p:h') . '/../misc/easytags/highlight.py'
endif
Please sign in to comment.
Something went wrong with that request. Please try again.