Mercurial > vim
comparison runtime/autoload/syntaxcomplete.vim @ 3996:b3f3237a3d72
Update runtime files.
author | Bram Moolenaar <bram@vim.org> |
---|---|
date | Wed, 05 Dec 2012 19:01:43 +0100 |
parents | c53344bacabf |
children | eb6ab7e78925 |
comparison
equal
deleted
inserted
replaced
3995:c2ea289a5b7f | 3996:b3f3237a3d72 |
---|---|
1 " Vim completion script | 1 " Vim completion script |
2 " Language: All languages, uses existing syntax highlighting rules | 2 " Language: All languages, uses existing syntax highlighting rules |
3 " Maintainer: David Fishburn <dfishburn dot vim at gmail dot com> | 3 " Maintainer: David Fishburn <dfishburn dot vim at gmail dot com> |
4 " Version: 10.0 | 4 " Version: 11.0 |
5 " Last Change: 2012 Oct 20 | 5 " Last Change: 2012 Dec 04 |
6 " Usage: For detailed help, ":help ft-syntax-omni" | 6 " Usage: For detailed help, ":help ft-syntax-omni" |
7 | 7 |
8 " History | 8 " History |
9 " | |
10 " Version 11.0 | |
11 " Corrected which characters required escaping during | |
12 " substitution calls. | |
9 " | 13 " |
10 " Version 10.0 | 14 " Version 10.0 |
11 " Cycle through all the character ranges specified in the | 15 " Cycle through all the character ranges specified in the |
12 " iskeyword option and build a list of valid word separators. | 16 " iskeyword option and build a list of valid word separators. |
13 " Prior to this change, only actual characters were used, | 17 " Prior to this change, only actual characters were used, |
14 " where for example ASCII "45" == "-". If "45" were used | 18 " where for example ASCII "45" == "-". If "45" were used |
15 " in iskeyword the hyphen would not be picked up. | 19 " in iskeyword the hyphen would not be picked up. |
16 " This introduces a new option, since the character ranges | 20 " This introduces a new option, since the character ranges |
17 " specified could be multibyte: | 21 " specified could be multibyte: |
18 " let g:omni_syntax_use_single_byte = 1 | 22 " let g:omni_syntax_use_single_byte = 1 |
19 " This by default will only allow single byte ASCII | 23 " This by default will only allow single byte ASCII |
20 " characters to be added and an additional check to ensure | 24 " characters to be added and an additional check to ensure |
21 " the charater is printable (see documentation for isprint). | 25 " the charater is printable (see documentation for isprint). |
22 " | 26 " |
23 " Version 9.0 | 27 " Version 9.0 |
24 " Add the check for cpo. | 28 " Add the check for cpo. |
30 " Now these lines are processed independently. | 34 " Now these lines are processed independently. |
31 " | 35 " |
32 " Version 7.0 | 36 " Version 7.0 |
33 " Updated syntaxcomplete#OmniSyntaxList() | 37 " Updated syntaxcomplete#OmniSyntaxList() |
34 " - Looking up the syntax groups defined from a syntax file | 38 " - Looking up the syntax groups defined from a syntax file |
35 " looked for only 1 format of {filetype}GroupName, but some | 39 " looked for only 1 format of {filetype}GroupName, but some |
36 " syntax writers use this format as well: | 40 " syntax writers use this format as well: |
37 " {b:current_syntax}GroupName | 41 " {b:current_syntax}GroupName |
38 " OmniSyntaxList() will now check for both if the first | 42 " OmniSyntaxList() will now check for both if the first |
39 " method does not find a match. | 43 " method does not find a match. |
40 " | 44 " |
41 " Version 6.0 | 45 " Version 6.0 |
42 " Added syntaxcomplete#OmniSyntaxList() | 46 " Added syntaxcomplete#OmniSyntaxList() |
43 " - Allows other plugins to use this for their own | 47 " - Allows other plugins to use this for their own |
44 " purposes. | 48 " purposes. |
45 " - It will return a List of all syntax items for the | 49 " - It will return a List of all syntax items for the |
46 " syntax group name passed in. | 50 " syntax group name passed in. |
47 " - XPTemplate for SQL will use this function via the | 51 " - XPTemplate for SQL will use this function via the |
48 " sqlcomplete plugin to populate a Choose box. | 52 " sqlcomplete plugin to populate a Choose box. |
49 " | 53 " |
50 " Version 5.0 | 54 " Version 5.0 |
51 " Updated SyntaxCSyntaxGroupItems() | 55 " Updated SyntaxCSyntaxGroupItems() |
52 " - When processing a list of syntax groups, the final group | 56 " - When processing a list of syntax groups, the final group |
53 " was missed in function SyntaxCSyntaxGroupItems. | 57 " was missed in function SyntaxCSyntaxGroupItems. |
54 " | 58 " |
55 " Set completion with CTRL-X CTRL-O to autoloaded function. | 59 " Set completion with CTRL-X CTRL-O to autoloaded function. |
56 " This check is in place in case this script is | 60 " This check is in place in case this script is |
57 " sourced directly instead of using the autoload feature. | 61 " sourced directly instead of using the autoload feature. |
58 if exists('+omnifunc') | 62 if exists('+omnifunc') |
59 " Do not set the option if already set since this | 63 " Do not set the option if already set since this |
60 " results in an E117 warning. | 64 " results in an E117 warning. |
61 if &omnifunc == "" | 65 if &omnifunc == "" |
62 setlocal omnifunc=syntaxcomplete#Complete | 66 setlocal omnifunc=syntaxcomplete#Complete |
63 endif | 67 endif |
64 endif | 68 endif |
65 | 69 |
66 if exists('g:loaded_syntax_completion') | 70 if exists('g:loaded_syntax_completion') |
67 finish | 71 finish |
68 endif | 72 endif |
69 let g:loaded_syntax_completion = 100 | 73 let g:loaded_syntax_completion = 110 |
70 | 74 |
71 " Turn on support for line continuations when creating the script | 75 " Turn on support for line continuations when creating the script |
72 let s:cpo_save = &cpo | 76 let s:cpo_save = &cpo |
73 set cpo&vim | 77 set cpo&vim |
74 | 78 |
188 endfunc | 192 endfunc |
189 | 193 |
190 function! syntaxcomplete#OmniSyntaxList(...) | 194 function! syntaxcomplete#OmniSyntaxList(...) |
191 if a:0 > 0 | 195 if a:0 > 0 |
192 let parms = [] | 196 let parms = [] |
193 if 3 == type(a:1) | 197 if 3 == type(a:1) |
194 let parms = a:1 | 198 let parms = a:1 |
195 elseif 1 == type(a:1) | 199 elseif 1 == type(a:1) |
196 let parms = split(a:1, ',') | 200 let parms = split(a:1, ',') |
197 endif | 201 endif |
198 return OmniSyntaxList( parms ) | 202 return OmniSyntaxList( parms ) |
202 endfunc | 206 endfunc |
203 | 207 |
204 function! OmniSyntaxList(...) | 208 function! OmniSyntaxList(...) |
205 let list_parms = [] | 209 let list_parms = [] |
206 if a:0 > 0 | 210 if a:0 > 0 |
207 if 3 == type(a:1) | 211 if 3 == type(a:1) |
208 let list_parms = a:1 | 212 let list_parms = a:1 |
209 elseif 1 == type(a:1) | 213 elseif 1 == type(a:1) |
210 let list_parms = split(a:1, ',') | 214 let list_parms = split(a:1, ',') |
211 endif | 215 endif |
212 endif | 216 endif |
238 endif | 242 endif |
239 endif | 243 endif |
240 | 244 |
241 let saveL = @l | 245 let saveL = @l |
242 let filetype = substitute(&filetype, '\.', '_', 'g') | 246 let filetype = substitute(&filetype, '\.', '_', 'g') |
243 | 247 |
244 if empty(list_parms) | 248 if empty(list_parms) |
245 " Default the include group to include the requested syntax group | 249 " Default the include group to include the requested syntax group |
246 let syntax_group_include_{filetype} = '' | 250 let syntax_group_include_{filetype} = '' |
247 " Check if there are any overrides specified for this filetype | 251 " Check if there are any overrides specified for this filetype |
248 if exists('g:omni_syntax_group_include_'.filetype) | 252 if exists('g:omni_syntax_group_include_'.filetype) |
249 let syntax_group_include_{filetype} = | 253 let syntax_group_include_{filetype} = |
250 \ substitute( g:omni_syntax_group_include_{filetype},'\s\+','','g') | 254 \ substitute( g:omni_syntax_group_include_{filetype},'\s\+','','g') |
251 let list_parms = split(g:omni_syntax_group_include_{filetype}, ',') | 255 let list_parms = split(g:omni_syntax_group_include_{filetype}, ',') |
252 if syntax_group_include_{filetype} =~ '\w' | 256 if syntax_group_include_{filetype} =~ '\w' |
253 let syntax_group_include_{filetype} = | 257 let syntax_group_include_{filetype} = |
254 \ substitute( syntax_group_include_{filetype}, | 258 \ substitute( syntax_group_include_{filetype}, |
255 \ '\s*,\s*', '\\|', 'g' | 259 \ '\s*,\s*', '\\|', 'g' |
256 \ ) | 260 \ ) |
257 endif | 261 endif |
258 endif | 262 endif |
259 else | 263 else |
260 " A specific list was provided, use it | 264 " A specific list was provided, use it |
261 endif | 265 endif |
262 | 266 |
263 " Loop through all the syntax groupnames, and build a | 267 " Loop through all the syntax groupnames, and build a |
264 " syntax file which contains these names. This can | 268 " syntax file which contains these names. This can |
265 " work generically for any filetype that does not already | 269 " work generically for any filetype that does not already |
266 " have a plugin defined. | 270 " have a plugin defined. |
267 " This ASSUMES the syntax groupname BEGINS with the name | 271 " This ASSUMES the syntax groupname BEGINS with the name |
268 " of the filetype. From my casual viewing of the vim7\syntax | 272 " of the filetype. From my casual viewing of the vim7\syntax |
269 " directory this is true for almost all syntax definitions. | 273 " directory this is true for almost all syntax definitions. |
270 " As an example, the SQL syntax groups have this pattern: | 274 " As an example, the SQL syntax groups have this pattern: |
271 " sqlType | 275 " sqlType |
272 " sqlOperators | 276 " sqlOperators |
273 " sqlKeyword ... | 277 " sqlKeyword ... |
276 redir END | 280 redir END |
277 | 281 |
278 let syntax_full = "\n".@l | 282 let syntax_full = "\n".@l |
279 let @l = saveL | 283 let @l = saveL |
280 | 284 |
281 if syntax_full =~ 'E28' | 285 if syntax_full =~ 'E28' |
282 \ || syntax_full =~ 'E411' | 286 \ || syntax_full =~ 'E411' |
283 \ || syntax_full =~ 'E415' | 287 \ || syntax_full =~ 'E415' |
284 \ || syntax_full =~ 'No Syntax items' | 288 \ || syntax_full =~ 'No Syntax items' |
285 return [] | 289 return [] |
286 endif | 290 endif |
287 | 291 |
288 let filetype = substitute(&filetype, '\.', '_', 'g') | 292 let filetype = substitute(&filetype, '\.', '_', 'g') |
289 | 293 |
290 let list_exclude_groups = [] | 294 let list_exclude_groups = [] |
291 if a:0 > 0 | 295 if a:0 > 0 |
292 " Do nothing since we have specific a specific list of groups | 296 " Do nothing since we have specific a specific list of groups |
293 else | 297 else |
294 " Default the exclude group to nothing | 298 " Default the exclude group to nothing |
295 let syntax_group_exclude_{filetype} = '' | 299 let syntax_group_exclude_{filetype} = '' |
296 " Check if there are any overrides specified for this filetype | 300 " Check if there are any overrides specified for this filetype |
297 if exists('g:omni_syntax_group_exclude_'.filetype) | 301 if exists('g:omni_syntax_group_exclude_'.filetype) |
298 let syntax_group_exclude_{filetype} = | 302 let syntax_group_exclude_{filetype} = |
299 \ substitute( g:omni_syntax_group_exclude_{filetype},'\s\+','','g') | 303 \ substitute( g:omni_syntax_group_exclude_{filetype},'\s\+','','g') |
300 let list_exclude_groups = split(g:omni_syntax_group_exclude_{filetype}, ',') | 304 let list_exclude_groups = split(g:omni_syntax_group_exclude_{filetype}, ',') |
301 if syntax_group_exclude_{filetype} =~ '\w' | 305 if syntax_group_exclude_{filetype} =~ '\w' |
302 let syntax_group_exclude_{filetype} = | 306 let syntax_group_exclude_{filetype} = |
303 \ substitute( syntax_group_exclude_{filetype}, | 307 \ substitute( syntax_group_exclude_{filetype}, |
304 \ '\s*,\s*', '\\|', 'g' | 308 \ '\s*,\s*', '\\|', 'g' |
305 \ ) | 309 \ ) |
306 endif | 310 endif |
307 endif | 311 endif |
308 endif | 312 endif |
315 let ftindex = match(&filetype, '\w\+', ftindex) | 319 let ftindex = match(&filetype, '\w\+', ftindex) |
316 | 320 |
317 while ftindex > -1 | 321 while ftindex > -1 |
318 let ft_part_name = matchstr( &filetype, '\w\+', ftindex ) | 322 let ft_part_name = matchstr( &filetype, '\w\+', ftindex ) |
319 | 323 |
320 " Syntax rules can contain items for more than just the current | 324 " Syntax rules can contain items for more than just the current |
321 " filetype. They can contain additional items added by the user | 325 " filetype. They can contain additional items added by the user |
322 " via autocmds or their vimrc. | 326 " via autocmds or their vimrc. |
323 " Some syntax files can be combined (html, php, jsp). | 327 " Some syntax files can be combined (html, php, jsp). |
324 " We want only items that begin with the filetype we are interested in. | 328 " We want only items that begin with the filetype we are interested in. |
325 let next_group_regex = '\n' . | 329 let next_group_regex = '\n' . |
326 \ '\zs'.ft_part_name.'\w\+\ze'. | 330 \ '\zs'.ft_part_name.'\w\+\ze'. |
327 \ '\s\+xxx\s\+' | 331 \ '\s\+xxx\s\+' |
328 let index = 0 | 332 let index = 0 |
329 let index = match(syntax_full, next_group_regex, index) | 333 let index = match(syntax_full, next_group_regex, index) |
330 | 334 |
331 if index == -1 && exists('b:current_syntax') && ft_part_name != b:current_syntax | 335 if index == -1 && exists('b:current_syntax') && ft_part_name != b:current_syntax |
332 " There appears to be two standards when writing syntax files. | 336 " There appears to be two standards when writing syntax files. |
336 " let b:current_syntax = "sqlanywhere" | 340 " let b:current_syntax = "sqlanywhere" |
337 " Or | 341 " Or |
338 " syn keyword {syntax_filename}Keyword values ... | 342 " syn keyword {syntax_filename}Keyword values ... |
339 " let b:current_syntax = "mysql" | 343 " let b:current_syntax = "mysql" |
340 " So, we will make the format of finding the syntax group names | 344 " So, we will make the format of finding the syntax group names |
341 " a bit more flexible and look for both if the first fails to | 345 " a bit more flexible and look for both if the first fails to |
342 " find a match. | 346 " find a match. |
343 let next_group_regex = '\n' . | 347 let next_group_regex = '\n' . |
344 \ '\zs'.b:current_syntax.'\w\+\ze'. | 348 \ '\zs'.b:current_syntax.'\w\+\ze'. |
345 \ '\s\+xxx\s\+' | 349 \ '\s\+xxx\s\+' |
346 let index = 0 | 350 let index = 0 |
347 let index = match(syntax_full, next_group_regex, index) | 351 let index = match(syntax_full, next_group_regex, index) |
348 endif | 352 endif |
349 | 353 |
350 while index > -1 | 354 while index > -1 |
354 for exclude_group_name in list_exclude_groups | 358 for exclude_group_name in list_exclude_groups |
355 if '\<'.exclude_group_name.'\>' =~ '\<'.group_name.'\>' | 359 if '\<'.exclude_group_name.'\>' =~ '\<'.group_name.'\>' |
356 let get_syn_list = 0 | 360 let get_syn_list = 0 |
357 endif | 361 endif |
358 endfor | 362 endfor |
359 | 363 |
360 " This code is no longer needed in version 6.0 since we have | 364 " This code is no longer needed in version 6.0 since we have |
361 " augmented the syntax list command to only retrieve the syntax | 365 " augmented the syntax list command to only retrieve the syntax |
362 " groups we are interested in. | 366 " groups we are interested in. |
363 " | 367 " |
364 " if get_syn_list == 1 | 368 " if get_syn_list == 1 |
365 " if syntax_group_include_{filetype} != '' | 369 " if syntax_group_include_{filetype} != '' |
366 " if '\<'.syntax_group_include_{filetype}.'\>' !~ '\<'.group_name.'\>' | 370 " if '\<'.syntax_group_include_{filetype}.'\>' !~ '\<'.group_name.'\>' |
368 " endif | 372 " endif |
369 " endif | 373 " endif |
370 " endif | 374 " endif |
371 | 375 |
372 if get_syn_list == 1 | 376 if get_syn_list == 1 |
373 " Pass in the full syntax listing, plus the group name we | 377 " Pass in the full syntax listing, plus the group name we |
374 " are interested in. | 378 " are interested in. |
375 let extra_syn_list = s:SyntaxCSyntaxGroupItems(group_name, syntax_full) | 379 let extra_syn_list = s:SyntaxCSyntaxGroupItems(group_name, syntax_full) |
376 let syn_list = syn_list . extra_syn_list . "\n" | 380 let syn_list = syn_list . extra_syn_list . "\n" |
377 endif | 381 endif |
378 | 382 |
422 " \( - start a group or 2 potential matches | 426 " \( - start a group or 2 potential matches |
423 " \n\w - at the first newline starting with a character | 427 " \n\w - at the first newline starting with a character |
424 " \| - 2nd potential match | 428 " \| - 2nd potential match |
425 " \%$ - matches end of the file or string | 429 " \%$ - matches end of the file or string |
426 " \) - end a group | 430 " \) - end a group |
427 let syntax_group = matchstr(a:syntax_full, | 431 let syntax_group = matchstr(a:syntax_full, |
428 \ "\n".a:group_name.'\s\+xxx\s\+\zs.\{-}\ze\(\n\w\|\%$\)' | 432 \ "\n".a:group_name.'\s\+xxx\s\+\zs.\{-}\ze\(\n\w\|\%$\)' |
429 \ ) | 433 \ ) |
430 | 434 |
431 if syntax_group != "" | 435 if syntax_group != "" |
432 " let syn_list = substitute( @l, '^.*xxx\s*\%(contained\s*\)\?', "", '' ) | 436 " let syn_list = substitute( @l, '^.*xxx\s*\%(contained\s*\)\?', "", '' ) |
433 " let syn_list = substitute( @l, '^.*xxx\s*', "", '' ) | 437 " let syn_list = substitute( @l, '^.*xxx\s*', "", '' ) |
434 | 438 |
435 " We only want the words for the lines begining with | 439 " We only want the words for the lines begining with |
436 " containedin, but there could be other items. | 440 " containedin, but there could be other items. |
437 | 441 |
438 " Tried to remove all lines that do not begin with contained | 442 " Tried to remove all lines that do not begin with contained |
439 " but this does not work in all cases since you can have | 443 " but this does not work in all cases since you can have |
440 " contained nextgroup=... | 444 " contained nextgroup=... |
441 " So this will strip off the ending of lines with known | 445 " So this will strip off the ending of lines with known |
442 " keywords. | 446 " keywords. |
443 let syn_list = substitute( | 447 let syn_list = substitute( |
444 \ syntax_group, '\<\('. | 448 \ syntax_group, '\<\('. |
445 \ substitute( | 449 \ substitute( |
446 \ escape(s:syn_remove_words, '\\/.*$^~[]') | 450 \ escape(s:syn_remove_words, '\\/.*$^~[]') |
447 \ , ',', '\\|', 'g' | 451 \ , ',', '\\|', 'g' |
448 \ ). | 452 \ ). |
449 \ '\).\{-}\%($\|'."\n".'\)' | 453 \ '\).\{-}\%($\|'."\n".'\)' |
450 \ , "\n", 'g' | 454 \ , "\n", 'g' |
451 \ ) | 455 \ ) |
452 | 456 |
453 " Now strip off the newline + blank space + contained. | 457 " Now strip off the newline + blank space + contained. |
454 " Also include lines with nextgroup=@someName skip_key_words syntax_element | 458 " Also include lines with nextgroup=@someName skip_key_words syntax_element |
455 let syn_list = substitute( | 459 let syn_list = substitute( |
456 \ syn_list, '\%(^\|\n\)\@<=\s*\<\(contained\|nextgroup=\)' | 460 \ syn_list, '\%(^\|\n\)\@<=\s*\<\(contained\|nextgroup=\)' |
457 \ , "", 'g' | 461 \ , "", 'g' |
458 \ ) | 462 \ ) |
459 | 463 |
460 " This can leave lines like this | 464 " This can leave lines like this |
461 " =@vimMenuList skipwhite onoremenu | 465 " =@vimMenuList skipwhite onoremenu |
462 " Strip the special option keywords first | 466 " Strip the special option keywords first |
463 " :h :syn-skipwhite* | 467 " :h :syn-skipwhite* |
464 let syn_list = substitute( | 468 let syn_list = substitute( |
465 \ syn_list, '\<\(skipwhite\|skipnl\|skipempty\)\>' | 469 \ syn_list, '\<\(skipwhite\|skipnl\|skipempty\)\>' |
466 \ , "", 'g' | 470 \ , "", 'g' |
467 \ ) | 471 \ ) |
468 | 472 |
469 " Now remove the remainder of the nextgroup=@someName lines | 473 " Now remove the remainder of the nextgroup=@someName lines |
470 let syn_list = substitute( | 474 let syn_list = substitute( |
471 \ syn_list, '\%(^\|\n\)\@<=\s*\(@\w\+\)' | 475 \ syn_list, '\%(^\|\n\)\@<=\s*\(@\w\+\)' |
472 \ , "", 'g' | 476 \ , "", 'g' |
473 \ ) | 477 \ ) |
474 | 478 |
475 if b:omni_syntax_use_iskeyword == 0 | 479 if b:omni_syntax_use_iskeyword == 0 |
476 " There are a number of items which have non-word characters in | 480 " There are a number of items which have non-word characters in |
477 " them, *'T_F1'*. vim.vim is one such file. | 481 " them, *'T_F1'*. vim.vim is one such file. |
482 " iskeyword can contain value like this | 486 " iskeyword can contain value like this |
483 " 38,42,43,45,47-58,60-62,64-90,97-122,_,+,-,*,/,%,<,=,>,:,$,?,!,@-@,94 | 487 " 38,42,43,45,47-58,60-62,64-90,97-122,_,+,-,*,/,%,<,=,>,:,$,?,!,@-@,94 |
484 " Numeric values convert to their ASCII equivalent using the | 488 " Numeric values convert to their ASCII equivalent using the |
485 " nr2char() function. | 489 " nr2char() function. |
486 " & 38 | 490 " & 38 |
487 " * 42 | 491 " * 42 |
488 " + 43 | 492 " + 43 |
489 " - 45 | 493 " - 45 |
490 " ^ 94 | 494 " ^ 94 |
491 " Iterate through all numeric specifications and convert those | 495 " Iterate through all numeric specifications and convert those |
492 " to their ascii equivalent ensuring the character is printable. | 496 " to their ascii equivalent ensuring the character is printable. |
493 " If so, add it to the list. | 497 " If so, add it to the list. |
494 let accepted_chars = '' | 498 let accepted_chars = '' |
495 for item in split(&iskeyword, ',') | 499 for item in split(&iskeyword, ',') |
496 if item =~ '-' | 500 if item =~ '-' |
497 " This is a character range (ie 47-58), | 501 " This is a character range (ie 47-58), |
498 " cycle through each character within the range | 502 " cycle through each character within the range |
499 let [b:start, b:end] = split(item, '-') | 503 let [b:start, b:end] = split(item, '-') |
500 for range_item in range( b:start, b:end ) | 504 for range_item in range( b:start, b:end ) |
501 if range_item <= 127 || g:omni_syntax_use_single_byte == 0 | 505 if range_item <= 127 || g:omni_syntax_use_single_byte == 0 |
502 if nr2char(range_item) =~ '\p' | 506 if nr2char(range_item) =~ '\p' |
518 endif | 522 endif |
519 endif | 523 endif |
520 endif | 524 endif |
521 endfor | 525 endfor |
522 " Escape special regex characters | 526 " Escape special regex characters |
523 let accepted_chars = escape(accepted_chars, '\\/.*$^~[]' ) | 527 " Looks like the wrong chars are escaped. In a collection, |
528 " :h /[] | |
529 " only `]', `\', `-' and `^' are special: | |
530 " let accepted_chars = escape(accepted_chars, '\\/.*$^~[]' ) | |
531 let accepted_chars = escape(accepted_chars, ']\-^' ) | |
524 " Remove all characters that are not acceptable | 532 " Remove all characters that are not acceptable |
525 let syn_list = substitute( syn_list, '[^A-Za-z'.accepted_chars.']', ' ', 'g' ) | 533 let syn_list = substitute( syn_list, '[^A-Za-z'.accepted_chars.']', ' ', 'g' ) |
526 else | 534 else |
527 let accept_chars = ','.&iskeyword.',' | 535 let accept_chars = ','.&iskeyword.',' |
528 " Remove all character ranges | 536 " Remove all character ranges |
532 " let accept_chars = substitute(accept_chars, ',\d\{-},', ',', 'g') | 540 " let accept_chars = substitute(accept_chars, ',\d\{-},', ',', 'g') |
533 let accept_chars = substitute(accept_chars, ',\@<=\d\{-},', '', 'g') | 541 let accept_chars = substitute(accept_chars, ',\@<=\d\{-},', '', 'g') |
534 " Remove all commas | 542 " Remove all commas |
535 let accept_chars = substitute(accept_chars, ',', '', 'g') | 543 let accept_chars = substitute(accept_chars, ',', '', 'g') |
536 " Escape special regex characters | 544 " Escape special regex characters |
537 let accept_chars = escape(accept_chars, '\\/.*$^~[]' ) | 545 " Looks like the wrong chars are escaped. In a collection, |
546 " :h /[] | |
547 " only `]', `\', `-' and `^' are special: | |
548 " let accept_chars = escape(accept_chars, '\\/.*$^~[]' ) | |
549 let accept_chars = escape(accept_chars, ']\-^' ) | |
538 " Remove all characters that are not acceptable | 550 " Remove all characters that are not acceptable |
539 let syn_list = substitute( syn_list, '[^0-9A-Za-z_'.accept_chars.']', ' ', 'g' ) | 551 let syn_list = substitute( syn_list, '[^0-9A-Za-z_'.accept_chars.']', ' ', 'g' ) |
540 endif | 552 endif |
541 endif | 553 endif |
542 | 554 |