annotate runtime/autoload/syntaxcomplete.vim @ 2735:322a5c8d392b v7.3.144

updated for version 7.3.144 Problem: Crash with ":python help(dir)". (Kearn Holliday) Solution: Fix the way the type is set on objects. (Tobias Columbus)
author Bram Moolenaar <bram@vim.org>
date Sat, 26 Mar 2011 13:56:48 +0100
parents 86532ee3ea41
children 8b8ef1fed009
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
625
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
1 " Vim completion script
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
2 " Language: All languages, uses existing syntax highlighting rules
2072
4a1bcdd9ea55 Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1620
diff changeset
3 " Maintainer: David Fishburn <dfishburn dot vim at gmail dot com>
2434
86532ee3ea41 Updated runtime files. Add logcheck filetype plugin. (James Vega)
Bram Moolenaar <bram@vim.org>
parents: 2072
diff changeset
4 " Version: 7.0
86532ee3ea41 Updated runtime files. Add logcheck filetype plugin. (James Vega)
Bram Moolenaar <bram@vim.org>
parents: 2072
diff changeset
5 " Last Change: 2010 Jul 29
871
c301dba834d0 updated for version 7.0g05
vimboss
parents: 818
diff changeset
6 " Usage: For detailed help, ":help ft-syntax-omni"
625
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
7
2072
4a1bcdd9ea55 Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1620
diff changeset
8 " History
2434
86532ee3ea41 Updated runtime files. Add logcheck filetype plugin. (James Vega)
Bram Moolenaar <bram@vim.org>
parents: 2072
diff changeset
9 "
86532ee3ea41 Updated runtime files. Add logcheck filetype plugin. (James Vega)
Bram Moolenaar <bram@vim.org>
parents: 2072
diff changeset
10 " Version 7.0
86532ee3ea41 Updated runtime files. Add logcheck filetype plugin. (James Vega)
Bram Moolenaar <bram@vim.org>
parents: 2072
diff changeset
11 " Updated syntaxcomplete#OmniSyntaxList()
86532ee3ea41 Updated runtime files. Add logcheck filetype plugin. (James Vega)
Bram Moolenaar <bram@vim.org>
parents: 2072
diff changeset
12 " - Looking up the syntax groups defined from a syntax file
86532ee3ea41 Updated runtime files. Add logcheck filetype plugin. (James Vega)
Bram Moolenaar <bram@vim.org>
parents: 2072
diff changeset
13 " looked for only 1 format of {filetype}GroupName, but some
86532ee3ea41 Updated runtime files. Add logcheck filetype plugin. (James Vega)
Bram Moolenaar <bram@vim.org>
parents: 2072
diff changeset
14 " syntax writers use this format as well:
86532ee3ea41 Updated runtime files. Add logcheck filetype plugin. (James Vega)
Bram Moolenaar <bram@vim.org>
parents: 2072
diff changeset
15 " {b:current_syntax}GroupName
86532ee3ea41 Updated runtime files. Add logcheck filetype plugin. (James Vega)
Bram Moolenaar <bram@vim.org>
parents: 2072
diff changeset
16 " OmniSyntaxList() will now check for both if the first
86532ee3ea41 Updated runtime files. Add logcheck filetype plugin. (James Vega)
Bram Moolenaar <bram@vim.org>
parents: 2072
diff changeset
17 " method does not find a match.
86532ee3ea41 Updated runtime files. Add logcheck filetype plugin. (James Vega)
Bram Moolenaar <bram@vim.org>
parents: 2072
diff changeset
18 "
86532ee3ea41 Updated runtime files. Add logcheck filetype plugin. (James Vega)
Bram Moolenaar <bram@vim.org>
parents: 2072
diff changeset
19 " Version 6.0
86532ee3ea41 Updated runtime files. Add logcheck filetype plugin. (James Vega)
Bram Moolenaar <bram@vim.org>
parents: 2072
diff changeset
20 " Added syntaxcomplete#OmniSyntaxList()
86532ee3ea41 Updated runtime files. Add logcheck filetype plugin. (James Vega)
Bram Moolenaar <bram@vim.org>
parents: 2072
diff changeset
21 " - Allows other plugins to use this for their own
86532ee3ea41 Updated runtime files. Add logcheck filetype plugin. (James Vega)
Bram Moolenaar <bram@vim.org>
parents: 2072
diff changeset
22 " purposes.
86532ee3ea41 Updated runtime files. Add logcheck filetype plugin. (James Vega)
Bram Moolenaar <bram@vim.org>
parents: 2072
diff changeset
23 " - It will return a List of all syntax items for the
86532ee3ea41 Updated runtime files. Add logcheck filetype plugin. (James Vega)
Bram Moolenaar <bram@vim.org>
parents: 2072
diff changeset
24 " syntax group name passed in.
86532ee3ea41 Updated runtime files. Add logcheck filetype plugin. (James Vega)
Bram Moolenaar <bram@vim.org>
parents: 2072
diff changeset
25 " - XPTemplate for SQL will use this function via the
86532ee3ea41 Updated runtime files. Add logcheck filetype plugin. (James Vega)
Bram Moolenaar <bram@vim.org>
parents: 2072
diff changeset
26 " sqlcomplete plugin to populate a Choose box.
86532ee3ea41 Updated runtime files. Add logcheck filetype plugin. (James Vega)
Bram Moolenaar <bram@vim.org>
parents: 2072
diff changeset
27 "
2072
4a1bcdd9ea55 Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1620
diff changeset
28 " Version 5.0
2434
86532ee3ea41 Updated runtime files. Add logcheck filetype plugin. (James Vega)
Bram Moolenaar <bram@vim.org>
parents: 2072
diff changeset
29 " Updated SyntaxCSyntaxGroupItems()
86532ee3ea41 Updated runtime files. Add logcheck filetype plugin. (James Vega)
Bram Moolenaar <bram@vim.org>
parents: 2072
diff changeset
30 " - When processing a list of syntax groups, the final group
86532ee3ea41 Updated runtime files. Add logcheck filetype plugin. (James Vega)
Bram Moolenaar <bram@vim.org>
parents: 2072
diff changeset
31 " was missed in function SyntaxCSyntaxGroupItems.
2072
4a1bcdd9ea55 Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1620
diff changeset
32 "
625
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
33 " Set completion with CTRL-X CTRL-O to autoloaded function.
785
fd60bacf955b updated for version 7.0229
vimboss
parents: 702
diff changeset
34 " This check is in place in case this script is
fd60bacf955b updated for version 7.0229
vimboss
parents: 702
diff changeset
35 " sourced directly instead of using the autoload feature.
702
8a99b25de218 updated for version 7.0212
vimboss
parents: 625
diff changeset
36 if exists('+omnifunc')
785
fd60bacf955b updated for version 7.0229
vimboss
parents: 702
diff changeset
37 " Do not set the option if already set since this
fd60bacf955b updated for version 7.0229
vimboss
parents: 702
diff changeset
38 " results in an E117 warning.
fd60bacf955b updated for version 7.0229
vimboss
parents: 702
diff changeset
39 if &omnifunc == ""
fd60bacf955b updated for version 7.0229
vimboss
parents: 702
diff changeset
40 setlocal omnifunc=syntaxcomplete#Complete
fd60bacf955b updated for version 7.0229
vimboss
parents: 702
diff changeset
41 endif
625
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
42 endif
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
43
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
44 if exists('g:loaded_syntax_completion')
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
45 finish
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
46 endif
2434
86532ee3ea41 Updated runtime files. Add logcheck filetype plugin. (James Vega)
Bram Moolenaar <bram@vim.org>
parents: 2072
diff changeset
47 let g:loaded_syntax_completion = 70
871
c301dba834d0 updated for version 7.0g05
vimboss
parents: 818
diff changeset
48
c301dba834d0 updated for version 7.0g05
vimboss
parents: 818
diff changeset
49 " Set ignorecase to the ftplugin standard
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 871
diff changeset
50 " This is the default setting, but if you define a buffer local
e63691e7c504 updated for version 7.1a
vimboss
parents: 871
diff changeset
51 " variable you can override this on a per filetype.
871
c301dba834d0 updated for version 7.0g05
vimboss
parents: 818
diff changeset
52 if !exists('g:omni_syntax_ignorecase')
c301dba834d0 updated for version 7.0g05
vimboss
parents: 818
diff changeset
53 let g:omni_syntax_ignorecase = &ignorecase
c301dba834d0 updated for version 7.0g05
vimboss
parents: 818
diff changeset
54 endif
625
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
55
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 871
diff changeset
56 " Indicates whether we should use the iskeyword option to determine
e63691e7c504 updated for version 7.1a
vimboss
parents: 871
diff changeset
57 " how to split words.
e63691e7c504 updated for version 7.1a
vimboss
parents: 871
diff changeset
58 " This is the default setting, but if you define a buffer local
e63691e7c504 updated for version 7.1a
vimboss
parents: 871
diff changeset
59 " variable you can override this on a per filetype.
e63691e7c504 updated for version 7.1a
vimboss
parents: 871
diff changeset
60 if !exists('g:omni_syntax_use_iskeyword')
e63691e7c504 updated for version 7.1a
vimboss
parents: 871
diff changeset
61 let g:omni_syntax_use_iskeyword = 1
e63691e7c504 updated for version 7.1a
vimboss
parents: 871
diff changeset
62 endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 871
diff changeset
63
e63691e7c504 updated for version 7.1a
vimboss
parents: 871
diff changeset
64 " Only display items in the completion window that are at least
e63691e7c504 updated for version 7.1a
vimboss
parents: 871
diff changeset
65 " this many characters in length.
e63691e7c504 updated for version 7.1a
vimboss
parents: 871
diff changeset
66 " This is the default setting, but if you define a buffer local
e63691e7c504 updated for version 7.1a
vimboss
parents: 871
diff changeset
67 " variable you can override this on a per filetype.
e63691e7c504 updated for version 7.1a
vimboss
parents: 871
diff changeset
68 if !exists('g:omni_syntax_minimum_length')
e63691e7c504 updated for version 7.1a
vimboss
parents: 871
diff changeset
69 let g:omni_syntax_minimum_length = 0
e63691e7c504 updated for version 7.1a
vimboss
parents: 871
diff changeset
70 endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 871
diff changeset
71
625
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
72 " This script will build a completion list based on the syntax
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
73 " elements defined by the files in $VIMRUNTIME/syntax.
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
74 let s:syn_remove_words = 'match,matchgroup=,contains,'.
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
75 \ 'links to,start=,end=,nextgroup='
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
76
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
77 let s:cache_name = []
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
78 let s:cache_list = []
785
fd60bacf955b updated for version 7.0229
vimboss
parents: 702
diff changeset
79 let s:prepended = ''
625
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
80
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
81 " This function is used for the 'omnifunc' option.
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
82 function! syntaxcomplete#Complete(findstart, base)
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
83
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 871
diff changeset
84 " Only display items in the completion window that are at least
e63691e7c504 updated for version 7.1a
vimboss
parents: 871
diff changeset
85 " this many characters in length
e63691e7c504 updated for version 7.1a
vimboss
parents: 871
diff changeset
86 if !exists('b:omni_syntax_ignorecase')
e63691e7c504 updated for version 7.1a
vimboss
parents: 871
diff changeset
87 if exists('g:omni_syntax_ignorecase')
e63691e7c504 updated for version 7.1a
vimboss
parents: 871
diff changeset
88 let b:omni_syntax_ignorecase = g:omni_syntax_ignorecase
e63691e7c504 updated for version 7.1a
vimboss
parents: 871
diff changeset
89 else
e63691e7c504 updated for version 7.1a
vimboss
parents: 871
diff changeset
90 let b:omni_syntax_ignorecase = &ignorecase
e63691e7c504 updated for version 7.1a
vimboss
parents: 871
diff changeset
91 endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 871
diff changeset
92 endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 871
diff changeset
93
625
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
94 if a:findstart
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
95 " Locate the start of the item, including "."
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
96 let line = getline('.')
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
97 let start = col('.') - 1
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
98 let lastword = -1
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
99 while start > 0
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 871
diff changeset
100 " if line[start - 1] =~ '\S'
e63691e7c504 updated for version 7.1a
vimboss
parents: 871
diff changeset
101 " let start -= 1
e63691e7c504 updated for version 7.1a
vimboss
parents: 871
diff changeset
102 " elseif line[start - 1] =~ '\.'
e63691e7c504 updated for version 7.1a
vimboss
parents: 871
diff changeset
103 if line[start - 1] =~ '\k'
625
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
104 let start -= 1
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 871
diff changeset
105 let lastword = a:findstart
625
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
106 else
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
107 break
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
108 endif
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
109 endwhile
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
110
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
111 " Return the column of the last word, which is going to be changed.
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
112 " Remember the text that comes before it in s:prepended.
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
113 if lastword == -1
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
114 let s:prepended = ''
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
115 return start
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
116 endif
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 871
diff changeset
117 let s:prepended = strpart(line, start, (col('.') - 1) - start)
e63691e7c504 updated for version 7.1a
vimboss
parents: 871
diff changeset
118 return start
625
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
119 endif
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
120
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 871
diff changeset
121 " let base = s:prepended . a:base
e63691e7c504 updated for version 7.1a
vimboss
parents: 871
diff changeset
122 let base = s:prepended
625
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
123
871
c301dba834d0 updated for version 7.0g05
vimboss
parents: 818
diff changeset
124 let filetype = substitute(&filetype, '\.', '_', 'g')
c301dba834d0 updated for version 7.0g05
vimboss
parents: 818
diff changeset
125 let list_idx = index(s:cache_name, filetype, 0, &ignorecase)
625
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
126 if list_idx > -1
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
127 let compl_list = s:cache_list[list_idx]
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
128 else
871
c301dba834d0 updated for version 7.0g05
vimboss
parents: 818
diff changeset
129 let compl_list = OmniSyntaxList()
c301dba834d0 updated for version 7.0g05
vimboss
parents: 818
diff changeset
130 let s:cache_name = add( s:cache_name, filetype )
c301dba834d0 updated for version 7.0g05
vimboss
parents: 818
diff changeset
131 let s:cache_list = add( s:cache_list, compl_list )
625
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
132 endif
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
133
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
134 " Return list of matches.
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
135
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 871
diff changeset
136 if base != ''
e63691e7c504 updated for version 7.1a
vimboss
parents: 871
diff changeset
137 " let compstr = join(compl_list, ' ')
e63691e7c504 updated for version 7.1a
vimboss
parents: 871
diff changeset
138 " let expr = (b:omni_syntax_ignorecase==0?'\C':'').'\<\%('.base.'\)\@!\w\+\s*'
e63691e7c504 updated for version 7.1a
vimboss
parents: 871
diff changeset
139 " let compstr = substitute(compstr, expr, '', 'g')
e63691e7c504 updated for version 7.1a
vimboss
parents: 871
diff changeset
140 " let compl_list = split(compstr, '\s\+')
e63691e7c504 updated for version 7.1a
vimboss
parents: 871
diff changeset
141
e63691e7c504 updated for version 7.1a
vimboss
parents: 871
diff changeset
142 " Filter the list based on the first few characters the user
e63691e7c504 updated for version 7.1a
vimboss
parents: 871
diff changeset
143 " entered
e63691e7c504 updated for version 7.1a
vimboss
parents: 871
diff changeset
144 let expr = 'v:val '.(g:omni_syntax_ignorecase==1?'=~?':'=~#')." '^".escape(base, '\\/.*$^~[]').".*'"
e63691e7c504 updated for version 7.1a
vimboss
parents: 871
diff changeset
145 let compl_list = filter(deepcopy(compl_list), expr)
625
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
146 endif
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
147
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
148 return compl_list
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
149 endfunc
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
150
2434
86532ee3ea41 Updated runtime files. Add logcheck filetype plugin. (James Vega)
Bram Moolenaar <bram@vim.org>
parents: 2072
diff changeset
151 function! syntaxcomplete#OmniSyntaxList(...)
86532ee3ea41 Updated runtime files. Add logcheck filetype plugin. (James Vega)
Bram Moolenaar <bram@vim.org>
parents: 2072
diff changeset
152 if a:0 > 0
86532ee3ea41 Updated runtime files. Add logcheck filetype plugin. (James Vega)
Bram Moolenaar <bram@vim.org>
parents: 2072
diff changeset
153 let parms = []
86532ee3ea41 Updated runtime files. Add logcheck filetype plugin. (James Vega)
Bram Moolenaar <bram@vim.org>
parents: 2072
diff changeset
154 if 3 == type(a:1)
86532ee3ea41 Updated runtime files. Add logcheck filetype plugin. (James Vega)
Bram Moolenaar <bram@vim.org>
parents: 2072
diff changeset
155 let parms = a:1
86532ee3ea41 Updated runtime files. Add logcheck filetype plugin. (James Vega)
Bram Moolenaar <bram@vim.org>
parents: 2072
diff changeset
156 elseif 1 == type(a:1)
86532ee3ea41 Updated runtime files. Add logcheck filetype plugin. (James Vega)
Bram Moolenaar <bram@vim.org>
parents: 2072
diff changeset
157 let parms = split(a:1, ',')
86532ee3ea41 Updated runtime files. Add logcheck filetype plugin. (James Vega)
Bram Moolenaar <bram@vim.org>
parents: 2072
diff changeset
158 endif
86532ee3ea41 Updated runtime files. Add logcheck filetype plugin. (James Vega)
Bram Moolenaar <bram@vim.org>
parents: 2072
diff changeset
159 return OmniSyntaxList( parms )
86532ee3ea41 Updated runtime files. Add logcheck filetype plugin. (James Vega)
Bram Moolenaar <bram@vim.org>
parents: 2072
diff changeset
160 else
86532ee3ea41 Updated runtime files. Add logcheck filetype plugin. (James Vega)
Bram Moolenaar <bram@vim.org>
parents: 2072
diff changeset
161 return OmniSyntaxList()
86532ee3ea41 Updated runtime files. Add logcheck filetype plugin. (James Vega)
Bram Moolenaar <bram@vim.org>
parents: 2072
diff changeset
162 endif
86532ee3ea41 Updated runtime files. Add logcheck filetype plugin. (James Vega)
Bram Moolenaar <bram@vim.org>
parents: 2072
diff changeset
163 endfunc
86532ee3ea41 Updated runtime files. Add logcheck filetype plugin. (James Vega)
Bram Moolenaar <bram@vim.org>
parents: 2072
diff changeset
164
86532ee3ea41 Updated runtime files. Add logcheck filetype plugin. (James Vega)
Bram Moolenaar <bram@vim.org>
parents: 2072
diff changeset
165 function! OmniSyntaxList(...)
86532ee3ea41 Updated runtime files. Add logcheck filetype plugin. (James Vega)
Bram Moolenaar <bram@vim.org>
parents: 2072
diff changeset
166 let list_parms = []
86532ee3ea41 Updated runtime files. Add logcheck filetype plugin. (James Vega)
Bram Moolenaar <bram@vim.org>
parents: 2072
diff changeset
167 if a:0 > 0
86532ee3ea41 Updated runtime files. Add logcheck filetype plugin. (James Vega)
Bram Moolenaar <bram@vim.org>
parents: 2072
diff changeset
168 if 3 == type(a:1)
86532ee3ea41 Updated runtime files. Add logcheck filetype plugin. (James Vega)
Bram Moolenaar <bram@vim.org>
parents: 2072
diff changeset
169 let list_parms = a:1
86532ee3ea41 Updated runtime files. Add logcheck filetype plugin. (James Vega)
Bram Moolenaar <bram@vim.org>
parents: 2072
diff changeset
170 elseif 1 == type(a:1)
86532ee3ea41 Updated runtime files. Add logcheck filetype plugin. (James Vega)
Bram Moolenaar <bram@vim.org>
parents: 2072
diff changeset
171 let list_parms = split(a:1, ',')
86532ee3ea41 Updated runtime files. Add logcheck filetype plugin. (James Vega)
Bram Moolenaar <bram@vim.org>
parents: 2072
diff changeset
172 endif
86532ee3ea41 Updated runtime files. Add logcheck filetype plugin. (James Vega)
Bram Moolenaar <bram@vim.org>
parents: 2072
diff changeset
173 endif
86532ee3ea41 Updated runtime files. Add logcheck filetype plugin. (James Vega)
Bram Moolenaar <bram@vim.org>
parents: 2072
diff changeset
174
871
c301dba834d0 updated for version 7.0g05
vimboss
parents: 818
diff changeset
175 " Default to returning a dictionary, if use_dictionary is set to 0
c301dba834d0 updated for version 7.0g05
vimboss
parents: 818
diff changeset
176 " a list will be returned.
c301dba834d0 updated for version 7.0g05
vimboss
parents: 818
diff changeset
177 " let use_dictionary = 1
c301dba834d0 updated for version 7.0g05
vimboss
parents: 818
diff changeset
178 " if a:0 > 0 && a:1 != ''
c301dba834d0 updated for version 7.0g05
vimboss
parents: 818
diff changeset
179 " let use_dictionary = a:1
c301dba834d0 updated for version 7.0g05
vimboss
parents: 818
diff changeset
180 " endif
c301dba834d0 updated for version 7.0g05
vimboss
parents: 818
diff changeset
181
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 871
diff changeset
182 " Only display items in the completion window that are at least
e63691e7c504 updated for version 7.1a
vimboss
parents: 871
diff changeset
183 " this many characters in length
e63691e7c504 updated for version 7.1a
vimboss
parents: 871
diff changeset
184 if !exists('b:omni_syntax_use_iskeyword')
e63691e7c504 updated for version 7.1a
vimboss
parents: 871
diff changeset
185 if exists('g:omni_syntax_use_iskeyword')
e63691e7c504 updated for version 7.1a
vimboss
parents: 871
diff changeset
186 let b:omni_syntax_use_iskeyword = g:omni_syntax_use_iskeyword
e63691e7c504 updated for version 7.1a
vimboss
parents: 871
diff changeset
187 else
e63691e7c504 updated for version 7.1a
vimboss
parents: 871
diff changeset
188 let b:omni_syntax_use_iskeyword = 1
e63691e7c504 updated for version 7.1a
vimboss
parents: 871
diff changeset
189 endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 871
diff changeset
190 endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 871
diff changeset
191
e63691e7c504 updated for version 7.1a
vimboss
parents: 871
diff changeset
192 " Only display items in the completion window that are at least
e63691e7c504 updated for version 7.1a
vimboss
parents: 871
diff changeset
193 " this many characters in length
e63691e7c504 updated for version 7.1a
vimboss
parents: 871
diff changeset
194 if !exists('b:omni_syntax_minimum_length')
e63691e7c504 updated for version 7.1a
vimboss
parents: 871
diff changeset
195 if exists('g:omni_syntax_minimum_length')
e63691e7c504 updated for version 7.1a
vimboss
parents: 871
diff changeset
196 let b:omni_syntax_minimum_length = g:omni_syntax_minimum_length
e63691e7c504 updated for version 7.1a
vimboss
parents: 871
diff changeset
197 else
e63691e7c504 updated for version 7.1a
vimboss
parents: 871
diff changeset
198 let b:omni_syntax_minimum_length = 0
e63691e7c504 updated for version 7.1a
vimboss
parents: 871
diff changeset
199 endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 871
diff changeset
200 endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 871
diff changeset
201
625
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
202 let saveL = @l
2434
86532ee3ea41 Updated runtime files. Add logcheck filetype plugin. (James Vega)
Bram Moolenaar <bram@vim.org>
parents: 2072
diff changeset
203 let filetype = substitute(&filetype, '\.', '_', 'g')
625
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
204
2434
86532ee3ea41 Updated runtime files. Add logcheck filetype plugin. (James Vega)
Bram Moolenaar <bram@vim.org>
parents: 2072
diff changeset
205 if empty(list_parms)
86532ee3ea41 Updated runtime files. Add logcheck filetype plugin. (James Vega)
Bram Moolenaar <bram@vim.org>
parents: 2072
diff changeset
206 " Default the include group to include the requested syntax group
86532ee3ea41 Updated runtime files. Add logcheck filetype plugin. (James Vega)
Bram Moolenaar <bram@vim.org>
parents: 2072
diff changeset
207 let syntax_group_include_{filetype} = ''
86532ee3ea41 Updated runtime files. Add logcheck filetype plugin. (James Vega)
Bram Moolenaar <bram@vim.org>
parents: 2072
diff changeset
208 " Check if there are any overrides specified for this filetype
86532ee3ea41 Updated runtime files. Add logcheck filetype plugin. (James Vega)
Bram Moolenaar <bram@vim.org>
parents: 2072
diff changeset
209 if exists('g:omni_syntax_group_include_'.filetype)
86532ee3ea41 Updated runtime files. Add logcheck filetype plugin. (James Vega)
Bram Moolenaar <bram@vim.org>
parents: 2072
diff changeset
210 let syntax_group_include_{filetype} =
86532ee3ea41 Updated runtime files. Add logcheck filetype plugin. (James Vega)
Bram Moolenaar <bram@vim.org>
parents: 2072
diff changeset
211 \ substitute( g:omni_syntax_group_include_{filetype},'\s\+','','g')
86532ee3ea41 Updated runtime files. Add logcheck filetype plugin. (James Vega)
Bram Moolenaar <bram@vim.org>
parents: 2072
diff changeset
212 let list_parms = split(g:omni_syntax_group_include_{filetype}, ',')
86532ee3ea41 Updated runtime files. Add logcheck filetype plugin. (James Vega)
Bram Moolenaar <bram@vim.org>
parents: 2072
diff changeset
213 if syntax_group_include_{filetype} =~ '\w'
86532ee3ea41 Updated runtime files. Add logcheck filetype plugin. (James Vega)
Bram Moolenaar <bram@vim.org>
parents: 2072
diff changeset
214 let syntax_group_include_{filetype} =
86532ee3ea41 Updated runtime files. Add logcheck filetype plugin. (James Vega)
Bram Moolenaar <bram@vim.org>
parents: 2072
diff changeset
215 \ substitute( syntax_group_include_{filetype},
86532ee3ea41 Updated runtime files. Add logcheck filetype plugin. (James Vega)
Bram Moolenaar <bram@vim.org>
parents: 2072
diff changeset
216 \ '\s*,\s*', '\\|', 'g'
86532ee3ea41 Updated runtime files. Add logcheck filetype plugin. (James Vega)
Bram Moolenaar <bram@vim.org>
parents: 2072
diff changeset
217 \ )
86532ee3ea41 Updated runtime files. Add logcheck filetype plugin. (James Vega)
Bram Moolenaar <bram@vim.org>
parents: 2072
diff changeset
218 endif
86532ee3ea41 Updated runtime files. Add logcheck filetype plugin. (James Vega)
Bram Moolenaar <bram@vim.org>
parents: 2072
diff changeset
219 endif
86532ee3ea41 Updated runtime files. Add logcheck filetype plugin. (James Vega)
Bram Moolenaar <bram@vim.org>
parents: 2072
diff changeset
220 else
86532ee3ea41 Updated runtime files. Add logcheck filetype plugin. (James Vega)
Bram Moolenaar <bram@vim.org>
parents: 2072
diff changeset
221 " A specific list was provided, use it
86532ee3ea41 Updated runtime files. Add logcheck filetype plugin. (James Vega)
Bram Moolenaar <bram@vim.org>
parents: 2072
diff changeset
222 endif
86532ee3ea41 Updated runtime files. Add logcheck filetype plugin. (James Vega)
Bram Moolenaar <bram@vim.org>
parents: 2072
diff changeset
223
625
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
224 " Loop through all the syntax groupnames, and build a
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
225 " syntax file which contains these names. This can
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
226 " work generically for any filetype that does not already
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
227 " have a plugin defined.
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
228 " This ASSUMES the syntax groupname BEGINS with the name
702
8a99b25de218 updated for version 7.0212
vimboss
parents: 625
diff changeset
229 " of the filetype. From my casual viewing of the vim7\syntax
2434
86532ee3ea41 Updated runtime files. Add logcheck filetype plugin. (James Vega)
Bram Moolenaar <bram@vim.org>
parents: 2072
diff changeset
230 " directory this is true for almost all syntax definitions.
86532ee3ea41 Updated runtime files. Add logcheck filetype plugin. (James Vega)
Bram Moolenaar <bram@vim.org>
parents: 2072
diff changeset
231 " As an example, the SQL syntax groups have this pattern:
86532ee3ea41 Updated runtime files. Add logcheck filetype plugin. (James Vega)
Bram Moolenaar <bram@vim.org>
parents: 2072
diff changeset
232 " sqlType
86532ee3ea41 Updated runtime files. Add logcheck filetype plugin. (James Vega)
Bram Moolenaar <bram@vim.org>
parents: 2072
diff changeset
233 " sqlOperators
86532ee3ea41 Updated runtime files. Add logcheck filetype plugin. (James Vega)
Bram Moolenaar <bram@vim.org>
parents: 2072
diff changeset
234 " sqlKeyword ...
625
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
235 redir @l
2434
86532ee3ea41 Updated runtime files. Add logcheck filetype plugin. (James Vega)
Bram Moolenaar <bram@vim.org>
parents: 2072
diff changeset
236 silent! exec 'syntax list '.join(list_parms)
625
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
237 redir END
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
238
702
8a99b25de218 updated for version 7.0212
vimboss
parents: 625
diff changeset
239 let syntax_full = "\n".@l
625
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
240 let @l = saveL
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
241
702
8a99b25de218 updated for version 7.0212
vimboss
parents: 625
diff changeset
242 if syntax_full =~ 'E28'
8a99b25de218 updated for version 7.0212
vimboss
parents: 625
diff changeset
243 \ || syntax_full =~ 'E411'
8a99b25de218 updated for version 7.0212
vimboss
parents: 625
diff changeset
244 \ || syntax_full =~ 'E415'
8a99b25de218 updated for version 7.0212
vimboss
parents: 625
diff changeset
245 \ || syntax_full =~ 'No Syntax items'
8a99b25de218 updated for version 7.0212
vimboss
parents: 625
diff changeset
246 return []
8a99b25de218 updated for version 7.0212
vimboss
parents: 625
diff changeset
247 endif
8a99b25de218 updated for version 7.0212
vimboss
parents: 625
diff changeset
248
871
c301dba834d0 updated for version 7.0g05
vimboss
parents: 818
diff changeset
249 let filetype = substitute(&filetype, '\.', '_', 'g')
c301dba834d0 updated for version 7.0g05
vimboss
parents: 818
diff changeset
250
2434
86532ee3ea41 Updated runtime files. Add logcheck filetype plugin. (James Vega)
Bram Moolenaar <bram@vim.org>
parents: 2072
diff changeset
251 let list_exclude_groups = []
86532ee3ea41 Updated runtime files. Add logcheck filetype plugin. (James Vega)
Bram Moolenaar <bram@vim.org>
parents: 2072
diff changeset
252 if a:0 > 0
86532ee3ea41 Updated runtime files. Add logcheck filetype plugin. (James Vega)
Bram Moolenaar <bram@vim.org>
parents: 2072
diff changeset
253 " Do nothing since we have specific a specific list of groups
86532ee3ea41 Updated runtime files. Add logcheck filetype plugin. (James Vega)
Bram Moolenaar <bram@vim.org>
parents: 2072
diff changeset
254 else
86532ee3ea41 Updated runtime files. Add logcheck filetype plugin. (James Vega)
Bram Moolenaar <bram@vim.org>
parents: 2072
diff changeset
255 " Default the exclude group to nothing
86532ee3ea41 Updated runtime files. Add logcheck filetype plugin. (James Vega)
Bram Moolenaar <bram@vim.org>
parents: 2072
diff changeset
256 let syntax_group_exclude_{filetype} = ''
86532ee3ea41 Updated runtime files. Add logcheck filetype plugin. (James Vega)
Bram Moolenaar <bram@vim.org>
parents: 2072
diff changeset
257 " Check if there are any overrides specified for this filetype
86532ee3ea41 Updated runtime files. Add logcheck filetype plugin. (James Vega)
Bram Moolenaar <bram@vim.org>
parents: 2072
diff changeset
258 if exists('g:omni_syntax_group_exclude_'.filetype)
86532ee3ea41 Updated runtime files. Add logcheck filetype plugin. (James Vega)
Bram Moolenaar <bram@vim.org>
parents: 2072
diff changeset
259 let syntax_group_exclude_{filetype} =
86532ee3ea41 Updated runtime files. Add logcheck filetype plugin. (James Vega)
Bram Moolenaar <bram@vim.org>
parents: 2072
diff changeset
260 \ substitute( g:omni_syntax_group_exclude_{filetype},'\s\+','','g')
86532ee3ea41 Updated runtime files. Add logcheck filetype plugin. (James Vega)
Bram Moolenaar <bram@vim.org>
parents: 2072
diff changeset
261 let list_exclude_groups = split(g:omni_syntax_group_exclude_{filetype}, ',')
86532ee3ea41 Updated runtime files. Add logcheck filetype plugin. (James Vega)
Bram Moolenaar <bram@vim.org>
parents: 2072
diff changeset
262 if syntax_group_exclude_{filetype} =~ '\w'
86532ee3ea41 Updated runtime files. Add logcheck filetype plugin. (James Vega)
Bram Moolenaar <bram@vim.org>
parents: 2072
diff changeset
263 let syntax_group_exclude_{filetype} =
86532ee3ea41 Updated runtime files. Add logcheck filetype plugin. (James Vega)
Bram Moolenaar <bram@vim.org>
parents: 2072
diff changeset
264 \ substitute( syntax_group_exclude_{filetype},
86532ee3ea41 Updated runtime files. Add logcheck filetype plugin. (James Vega)
Bram Moolenaar <bram@vim.org>
parents: 2072
diff changeset
265 \ '\s*,\s*', '\\|', 'g'
86532ee3ea41 Updated runtime files. Add logcheck filetype plugin. (James Vega)
Bram Moolenaar <bram@vim.org>
parents: 2072
diff changeset
266 \ )
86532ee3ea41 Updated runtime files. Add logcheck filetype plugin. (James Vega)
Bram Moolenaar <bram@vim.org>
parents: 2072
diff changeset
267 endif
702
8a99b25de218 updated for version 7.0212
vimboss
parents: 625
diff changeset
268 endif
8a99b25de218 updated for version 7.0212
vimboss
parents: 625
diff changeset
269 endif
8a99b25de218 updated for version 7.0212
vimboss
parents: 625
diff changeset
270
871
c301dba834d0 updated for version 7.0g05
vimboss
parents: 818
diff changeset
271 " Sometimes filetypes can be composite names, like c.doxygen
c301dba834d0 updated for version 7.0g05
vimboss
parents: 818
diff changeset
272 " Loop through each individual part looking for the syntax
c301dba834d0 updated for version 7.0g05
vimboss
parents: 818
diff changeset
273 " items specific to each individual filetype.
625
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
274 let syn_list = ''
871
c301dba834d0 updated for version 7.0g05
vimboss
parents: 818
diff changeset
275 let ftindex = 0
c301dba834d0 updated for version 7.0g05
vimboss
parents: 818
diff changeset
276 let ftindex = match(&filetype, '\w\+', ftindex)
625
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
277
871
c301dba834d0 updated for version 7.0g05
vimboss
parents: 818
diff changeset
278 while ftindex > -1
c301dba834d0 updated for version 7.0g05
vimboss
parents: 818
diff changeset
279 let ft_part_name = matchstr( &filetype, '\w\+', ftindex )
625
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
280
871
c301dba834d0 updated for version 7.0g05
vimboss
parents: 818
diff changeset
281 " Syntax rules can contain items for more than just the current
c301dba834d0 updated for version 7.0g05
vimboss
parents: 818
diff changeset
282 " filetype. They can contain additional items added by the user
c301dba834d0 updated for version 7.0g05
vimboss
parents: 818
diff changeset
283 " via autocmds or their vimrc.
c301dba834d0 updated for version 7.0g05
vimboss
parents: 818
diff changeset
284 " Some syntax files can be combined (html, php, jsp).
c301dba834d0 updated for version 7.0g05
vimboss
parents: 818
diff changeset
285 " We want only items that begin with the filetype we are interested in.
c301dba834d0 updated for version 7.0g05
vimboss
parents: 818
diff changeset
286 let next_group_regex = '\n' .
c301dba834d0 updated for version 7.0g05
vimboss
parents: 818
diff changeset
287 \ '\zs'.ft_part_name.'\w\+\ze'.
c301dba834d0 updated for version 7.0g05
vimboss
parents: 818
diff changeset
288 \ '\s\+xxx\s\+'
c301dba834d0 updated for version 7.0g05
vimboss
parents: 818
diff changeset
289 let index = 0
c301dba834d0 updated for version 7.0g05
vimboss
parents: 818
diff changeset
290 let index = match(syntax_full, next_group_regex, index)
c301dba834d0 updated for version 7.0g05
vimboss
parents: 818
diff changeset
291
2434
86532ee3ea41 Updated runtime files. Add logcheck filetype plugin. (James Vega)
Bram Moolenaar <bram@vim.org>
parents: 2072
diff changeset
292 if index == -1 && exists('b:current_syntax') && ft_part_name != b:current_syntax
86532ee3ea41 Updated runtime files. Add logcheck filetype plugin. (James Vega)
Bram Moolenaar <bram@vim.org>
parents: 2072
diff changeset
293 " There appears to be two standards when writing syntax files.
86532ee3ea41 Updated runtime files. Add logcheck filetype plugin. (James Vega)
Bram Moolenaar <bram@vim.org>
parents: 2072
diff changeset
294 " Either items begin as:
86532ee3ea41 Updated runtime files. Add logcheck filetype plugin. (James Vega)
Bram Moolenaar <bram@vim.org>
parents: 2072
diff changeset
295 " syn keyword {filetype}Keyword values ...
86532ee3ea41 Updated runtime files. Add logcheck filetype plugin. (James Vega)
Bram Moolenaar <bram@vim.org>
parents: 2072
diff changeset
296 " let b:current_syntax = "sql"
86532ee3ea41 Updated runtime files. Add logcheck filetype plugin. (James Vega)
Bram Moolenaar <bram@vim.org>
parents: 2072
diff changeset
297 " let b:current_syntax = "sqlanywhere"
86532ee3ea41 Updated runtime files. Add logcheck filetype plugin. (James Vega)
Bram Moolenaar <bram@vim.org>
parents: 2072
diff changeset
298 " Or
86532ee3ea41 Updated runtime files. Add logcheck filetype plugin. (James Vega)
Bram Moolenaar <bram@vim.org>
parents: 2072
diff changeset
299 " syn keyword {syntax_filename}Keyword values ...
86532ee3ea41 Updated runtime files. Add logcheck filetype plugin. (James Vega)
Bram Moolenaar <bram@vim.org>
parents: 2072
diff changeset
300 " let b:current_syntax = "mysql"
86532ee3ea41 Updated runtime files. Add logcheck filetype plugin. (James Vega)
Bram Moolenaar <bram@vim.org>
parents: 2072
diff changeset
301 " So, we will make the format of finding the syntax group names
86532ee3ea41 Updated runtime files. Add logcheck filetype plugin. (James Vega)
Bram Moolenaar <bram@vim.org>
parents: 2072
diff changeset
302 " a bit more flexible and look for both if the first fails to
86532ee3ea41 Updated runtime files. Add logcheck filetype plugin. (James Vega)
Bram Moolenaar <bram@vim.org>
parents: 2072
diff changeset
303 " find a match.
86532ee3ea41 Updated runtime files. Add logcheck filetype plugin. (James Vega)
Bram Moolenaar <bram@vim.org>
parents: 2072
diff changeset
304 let next_group_regex = '\n' .
86532ee3ea41 Updated runtime files. Add logcheck filetype plugin. (James Vega)
Bram Moolenaar <bram@vim.org>
parents: 2072
diff changeset
305 \ '\zs'.b:current_syntax.'\w\+\ze'.
86532ee3ea41 Updated runtime files. Add logcheck filetype plugin. (James Vega)
Bram Moolenaar <bram@vim.org>
parents: 2072
diff changeset
306 \ '\s\+xxx\s\+'
86532ee3ea41 Updated runtime files. Add logcheck filetype plugin. (James Vega)
Bram Moolenaar <bram@vim.org>
parents: 2072
diff changeset
307 let index = 0
86532ee3ea41 Updated runtime files. Add logcheck filetype plugin. (James Vega)
Bram Moolenaar <bram@vim.org>
parents: 2072
diff changeset
308 let index = match(syntax_full, next_group_regex, index)
86532ee3ea41 Updated runtime files. Add logcheck filetype plugin. (James Vega)
Bram Moolenaar <bram@vim.org>
parents: 2072
diff changeset
309 endif
86532ee3ea41 Updated runtime files. Add logcheck filetype plugin. (James Vega)
Bram Moolenaar <bram@vim.org>
parents: 2072
diff changeset
310
871
c301dba834d0 updated for version 7.0g05
vimboss
parents: 818
diff changeset
311 while index > -1
c301dba834d0 updated for version 7.0g05
vimboss
parents: 818
diff changeset
312 let group_name = matchstr( syntax_full, '\w\+', index )
c301dba834d0 updated for version 7.0g05
vimboss
parents: 818
diff changeset
313
c301dba834d0 updated for version 7.0g05
vimboss
parents: 818
diff changeset
314 let get_syn_list = 1
2434
86532ee3ea41 Updated runtime files. Add logcheck filetype plugin. (James Vega)
Bram Moolenaar <bram@vim.org>
parents: 2072
diff changeset
315 for exclude_group_name in list_exclude_groups
86532ee3ea41 Updated runtime files. Add logcheck filetype plugin. (James Vega)
Bram Moolenaar <bram@vim.org>
parents: 2072
diff changeset
316 if '\<'.exclude_group_name.'\>' =~ '\<'.group_name.'\>'
86532ee3ea41 Updated runtime files. Add logcheck filetype plugin. (James Vega)
Bram Moolenaar <bram@vim.org>
parents: 2072
diff changeset
317 let get_syn_list = 0
86532ee3ea41 Updated runtime files. Add logcheck filetype plugin. (James Vega)
Bram Moolenaar <bram@vim.org>
parents: 2072
diff changeset
318 endif
86532ee3ea41 Updated runtime files. Add logcheck filetype plugin. (James Vega)
Bram Moolenaar <bram@vim.org>
parents: 2072
diff changeset
319 endfor
86532ee3ea41 Updated runtime files. Add logcheck filetype plugin. (James Vega)
Bram Moolenaar <bram@vim.org>
parents: 2072
diff changeset
320
86532ee3ea41 Updated runtime files. Add logcheck filetype plugin. (James Vega)
Bram Moolenaar <bram@vim.org>
parents: 2072
diff changeset
321 " This code is no longer needed in version 6.0 since we have
86532ee3ea41 Updated runtime files. Add logcheck filetype plugin. (James Vega)
Bram Moolenaar <bram@vim.org>
parents: 2072
diff changeset
322 " augmented the syntax list command to only retrieve the syntax
86532ee3ea41 Updated runtime files. Add logcheck filetype plugin. (James Vega)
Bram Moolenaar <bram@vim.org>
parents: 2072
diff changeset
323 " groups we are interested in.
86532ee3ea41 Updated runtime files. Add logcheck filetype plugin. (James Vega)
Bram Moolenaar <bram@vim.org>
parents: 2072
diff changeset
324 "
86532ee3ea41 Updated runtime files. Add logcheck filetype plugin. (James Vega)
Bram Moolenaar <bram@vim.org>
parents: 2072
diff changeset
325 " if get_syn_list == 1
86532ee3ea41 Updated runtime files. Add logcheck filetype plugin. (James Vega)
Bram Moolenaar <bram@vim.org>
parents: 2072
diff changeset
326 " if syntax_group_include_{filetype} != ''
86532ee3ea41 Updated runtime files. Add logcheck filetype plugin. (James Vega)
Bram Moolenaar <bram@vim.org>
parents: 2072
diff changeset
327 " if '\<'.syntax_group_include_{filetype}.'\>' !~ '\<'.group_name.'\>'
871
c301dba834d0 updated for version 7.0g05
vimboss
parents: 818
diff changeset
328 " let get_syn_list = 0
c301dba834d0 updated for version 7.0g05
vimboss
parents: 818
diff changeset
329 " endif
c301dba834d0 updated for version 7.0g05
vimboss
parents: 818
diff changeset
330 " endif
c301dba834d0 updated for version 7.0g05
vimboss
parents: 818
diff changeset
331 " endif
c301dba834d0 updated for version 7.0g05
vimboss
parents: 818
diff changeset
332
c301dba834d0 updated for version 7.0g05
vimboss
parents: 818
diff changeset
333 if get_syn_list == 1
c301dba834d0 updated for version 7.0g05
vimboss
parents: 818
diff changeset
334 " Pass in the full syntax listing, plus the group name we
c301dba834d0 updated for version 7.0g05
vimboss
parents: 818
diff changeset
335 " are interested in.
c301dba834d0 updated for version 7.0g05
vimboss
parents: 818
diff changeset
336 let extra_syn_list = s:SyntaxCSyntaxGroupItems(group_name, syntax_full)
c301dba834d0 updated for version 7.0g05
vimboss
parents: 818
diff changeset
337 let syn_list = syn_list . extra_syn_list . "\n"
c301dba834d0 updated for version 7.0g05
vimboss
parents: 818
diff changeset
338 endif
625
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
339
871
c301dba834d0 updated for version 7.0g05
vimboss
parents: 818
diff changeset
340 let index = index + strlen(group_name)
c301dba834d0 updated for version 7.0g05
vimboss
parents: 818
diff changeset
341 let index = match(syntax_full, next_group_regex, index)
c301dba834d0 updated for version 7.0g05
vimboss
parents: 818
diff changeset
342 endwhile
c301dba834d0 updated for version 7.0g05
vimboss
parents: 818
diff changeset
343
c301dba834d0 updated for version 7.0g05
vimboss
parents: 818
diff changeset
344 let ftindex = ftindex + len(ft_part_name)
c301dba834d0 updated for version 7.0g05
vimboss
parents: 818
diff changeset
345 let ftindex = match( &filetype, '\w\+', ftindex )
625
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
346 endwhile
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
347
702
8a99b25de218 updated for version 7.0212
vimboss
parents: 625
diff changeset
348 " Convert the string to a List and sort it.
8a99b25de218 updated for version 7.0212
vimboss
parents: 625
diff changeset
349 let compl_list = sort(split(syn_list))
8a99b25de218 updated for version 7.0212
vimboss
parents: 625
diff changeset
350
8a99b25de218 updated for version 7.0212
vimboss
parents: 625
diff changeset
351 if &filetype == 'vim'
8a99b25de218 updated for version 7.0212
vimboss
parents: 625
diff changeset
352 let short_compl_list = []
8a99b25de218 updated for version 7.0212
vimboss
parents: 625
diff changeset
353 for i in range(len(compl_list))
8a99b25de218 updated for version 7.0212
vimboss
parents: 625
diff changeset
354 if i == len(compl_list)-1
8a99b25de218 updated for version 7.0212
vimboss
parents: 625
diff changeset
355 let next = i
8a99b25de218 updated for version 7.0212
vimboss
parents: 625
diff changeset
356 else
8a99b25de218 updated for version 7.0212
vimboss
parents: 625
diff changeset
357 let next = i + 1
8a99b25de218 updated for version 7.0212
vimboss
parents: 625
diff changeset
358 endif
8a99b25de218 updated for version 7.0212
vimboss
parents: 625
diff changeset
359 if compl_list[next] !~ '^'.compl_list[i].'.$'
8a99b25de218 updated for version 7.0212
vimboss
parents: 625
diff changeset
360 let short_compl_list += [compl_list[i]]
8a99b25de218 updated for version 7.0212
vimboss
parents: 625
diff changeset
361 endif
8a99b25de218 updated for version 7.0212
vimboss
parents: 625
diff changeset
362 endfor
8a99b25de218 updated for version 7.0212
vimboss
parents: 625
diff changeset
363
8a99b25de218 updated for version 7.0212
vimboss
parents: 625
diff changeset
364 return short_compl_list
8a99b25de218 updated for version 7.0212
vimboss
parents: 625
diff changeset
365 else
8a99b25de218 updated for version 7.0212
vimboss
parents: 625
diff changeset
366 return compl_list
8a99b25de218 updated for version 7.0212
vimboss
parents: 625
diff changeset
367 endif
625
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
368 endfunction
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
369
818
1f929f3ca806 updated for version 7.0c03
vimboss
parents: 785
diff changeset
370 function! s:SyntaxCSyntaxGroupItems( group_name, syntax_full )
702
8a99b25de218 updated for version 7.0212
vimboss
parents: 625
diff changeset
371
8a99b25de218 updated for version 7.0212
vimboss
parents: 625
diff changeset
372 let syn_list = ""
625
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
373
702
8a99b25de218 updated for version 7.0212
vimboss
parents: 625
diff changeset
374 " From the full syntax listing, strip out the portion for the
8a99b25de218 updated for version 7.0212
vimboss
parents: 625
diff changeset
375 " request group.
8a99b25de218 updated for version 7.0212
vimboss
parents: 625
diff changeset
376 " Query:
8a99b25de218 updated for version 7.0212
vimboss
parents: 625
diff changeset
377 " \n - must begin with a newline
8a99b25de218 updated for version 7.0212
vimboss
parents: 625
diff changeset
378 " a:group_name - the group name we are interested in
8a99b25de218 updated for version 7.0212
vimboss
parents: 625
diff changeset
379 " \s\+xxx\s\+ - group names are always followed by xxx
8a99b25de218 updated for version 7.0212
vimboss
parents: 625
diff changeset
380 " \zs - start the match
8a99b25de218 updated for version 7.0212
vimboss
parents: 625
diff changeset
381 " .\{-} - everything ...
8a99b25de218 updated for version 7.0212
vimboss
parents: 625
diff changeset
382 " \ze - end the match
2072
4a1bcdd9ea55 Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1620
diff changeset
383 " \( - start a group or 2 potential matches
702
8a99b25de218 updated for version 7.0212
vimboss
parents: 625
diff changeset
384 " \n\w - at the first newline starting with a character
2072
4a1bcdd9ea55 Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1620
diff changeset
385 " \| - 2nd potential match
4a1bcdd9ea55 Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1620
diff changeset
386 " \%$ - matches end of the file or string
4a1bcdd9ea55 Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1620
diff changeset
387 " \) - end a group
702
8a99b25de218 updated for version 7.0212
vimboss
parents: 625
diff changeset
388 let syntax_group = matchstr(a:syntax_full,
2072
4a1bcdd9ea55 Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1620
diff changeset
389 \ "\n".a:group_name.'\s\+xxx\s\+\zs.\{-}\ze\(\n\w\|\%$\)'
871
c301dba834d0 updated for version 7.0g05
vimboss
parents: 818
diff changeset
390 \ )
702
8a99b25de218 updated for version 7.0212
vimboss
parents: 625
diff changeset
391
8a99b25de218 updated for version 7.0212
vimboss
parents: 625
diff changeset
392 if syntax_group != ""
625
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
393 " let syn_list = substitute( @l, '^.*xxx\s*\%(contained\s*\)\?', "", '' )
702
8a99b25de218 updated for version 7.0212
vimboss
parents: 625
diff changeset
394 " let syn_list = substitute( @l, '^.*xxx\s*', "", '' )
625
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
395
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
396 " We only want the words for the lines begining with
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
397 " containedin, but there could be other items.
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
398
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
399 " Tried to remove all lines that do not begin with contained
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
400 " but this does not work in all cases since you can have
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
401 " contained nextgroup=...
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
402 " So this will strip off the ending of lines with known
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
403 " keywords.
871
c301dba834d0 updated for version 7.0g05
vimboss
parents: 818
diff changeset
404 let syn_list = substitute(
c301dba834d0 updated for version 7.0g05
vimboss
parents: 818
diff changeset
405 \ syntax_group, '\<\('.
c301dba834d0 updated for version 7.0g05
vimboss
parents: 818
diff changeset
406 \ substitute(
c301dba834d0 updated for version 7.0g05
vimboss
parents: 818
diff changeset
407 \ escape(s:syn_remove_words, '\\/.*$^~[]')
c301dba834d0 updated for version 7.0g05
vimboss
parents: 818
diff changeset
408 \ , ',', '\\|', 'g'
c301dba834d0 updated for version 7.0g05
vimboss
parents: 818
diff changeset
409 \ ).
c301dba834d0 updated for version 7.0g05
vimboss
parents: 818
diff changeset
410 \ '\).\{-}\%($\|'."\n".'\)'
c301dba834d0 updated for version 7.0g05
vimboss
parents: 818
diff changeset
411 \ , "\n", 'g'
c301dba834d0 updated for version 7.0g05
vimboss
parents: 818
diff changeset
412 \ )
625
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
413
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
414 " Now strip off the newline + blank space + contained
871
c301dba834d0 updated for version 7.0g05
vimboss
parents: 818
diff changeset
415 let syn_list = substitute(
c301dba834d0 updated for version 7.0g05
vimboss
parents: 818
diff changeset
416 \ syn_list, '\%(^\|\n\)\@<=\s*\<\(contained\)'
c301dba834d0 updated for version 7.0g05
vimboss
parents: 818
diff changeset
417 \ , "", 'g'
c301dba834d0 updated for version 7.0g05
vimboss
parents: 818
diff changeset
418 \ )
625
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
419
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 871
diff changeset
420 if b:omni_syntax_use_iskeyword == 0
e63691e7c504 updated for version 7.1a
vimboss
parents: 871
diff changeset
421 " There are a number of items which have non-word characters in
e63691e7c504 updated for version 7.1a
vimboss
parents: 871
diff changeset
422 " them, *'T_F1'*. vim.vim is one such file.
e63691e7c504 updated for version 7.1a
vimboss
parents: 871
diff changeset
423 " This will replace non-word characters with spaces.
e63691e7c504 updated for version 7.1a
vimboss
parents: 871
diff changeset
424 let syn_list = substitute( syn_list, '[^0-9A-Za-z_ ]', ' ', 'g' )
e63691e7c504 updated for version 7.1a
vimboss
parents: 871
diff changeset
425 else
e63691e7c504 updated for version 7.1a
vimboss
parents: 871
diff changeset
426 let accept_chars = ','.&iskeyword.','
e63691e7c504 updated for version 7.1a
vimboss
parents: 871
diff changeset
427 " Remove all character ranges
1620
73fe8baea242 updated for version 7.2a
vimboss
parents: 1121
diff changeset
428 " let accept_chars = substitute(accept_chars, ',[^,]\+-[^,]\+,', ',', 'g')
73fe8baea242 updated for version 7.2a
vimboss
parents: 1121
diff changeset
429 let accept_chars = substitute(accept_chars, ',\@<=[^,]\+-[^,]\+,', '', 'g')
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 871
diff changeset
430 " Remove all numeric specifications
1620
73fe8baea242 updated for version 7.2a
vimboss
parents: 1121
diff changeset
431 " let accept_chars = substitute(accept_chars, ',\d\{-},', ',', 'g')
73fe8baea242 updated for version 7.2a
vimboss
parents: 1121
diff changeset
432 let accept_chars = substitute(accept_chars, ',\@<=\d\{-},', '', 'g')
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 871
diff changeset
433 " Remove all commas
e63691e7c504 updated for version 7.1a
vimboss
parents: 871
diff changeset
434 let accept_chars = substitute(accept_chars, ',', '', 'g')
e63691e7c504 updated for version 7.1a
vimboss
parents: 871
diff changeset
435 " Escape special regex characters
e63691e7c504 updated for version 7.1a
vimboss
parents: 871
diff changeset
436 let accept_chars = escape(accept_chars, '\\/.*$^~[]' )
e63691e7c504 updated for version 7.1a
vimboss
parents: 871
diff changeset
437 " Remove all characters that are not acceptable
e63691e7c504 updated for version 7.1a
vimboss
parents: 871
diff changeset
438 let syn_list = substitute( syn_list, '[^0-9A-Za-z_ '.accept_chars.']', ' ', 'g' )
e63691e7c504 updated for version 7.1a
vimboss
parents: 871
diff changeset
439 endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 871
diff changeset
440
e63691e7c504 updated for version 7.1a
vimboss
parents: 871
diff changeset
441 if b:omni_syntax_minimum_length > 0
e63691e7c504 updated for version 7.1a
vimboss
parents: 871
diff changeset
442 " If the user specified a minimum length, enforce it
e63691e7c504 updated for version 7.1a
vimboss
parents: 871
diff changeset
443 let syn_list = substitute(' '.syn_list.' ', ' \S\{,'.b:omni_syntax_minimum_length.'}\ze ', ' ', 'g')
e63691e7c504 updated for version 7.1a
vimboss
parents: 871
diff changeset
444 endif
625
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
445 else
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
446 let syn_list = ''
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
447 endif
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
448
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
449 return syn_list
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
450 endfunction