annotate runtime/autoload/syntaxcomplete.vim @ 3848:a2fe24ec6a0d v7.3.681

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