diff options
author | Bram Moolenaar <Bram@vim.org> | 2006-05-06 21:40:45 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2006-05-06 21:40:45 +0000 |
commit | 97e8f356004f564d3232a64428927d3c29164f66 (patch) | |
tree | 6bea84d530dd3ff352dbffdc41beac297ee735e4 | |
parent | 773560bc6052d6ee44f5ca0bef1a476ea434f432 (diff) | |
download | vim-97e8f356004f564d3232a64428927d3c29164f66.zip |
updated for version 7.0g05
-rw-r--r-- | runtime/autoload/syntaxcomplete.vim | 196 | ||||
-rw-r--r-- | runtime/spell/en.ascii.spl | bin | 568018 -> 568018 bytes | |||
-rw-r--r-- | runtime/spell/en.latin1.sug | bin | 556476 -> 556476 bytes | |||
-rw-r--r-- | runtime/spell/en.utf-8.spl | bin | 570548 -> 570548 bytes |
4 files changed, 118 insertions, 78 deletions
diff --git a/runtime/autoload/syntaxcomplete.vim b/runtime/autoload/syntaxcomplete.vim index 6158a271c..5e0d013c6 100644 --- a/runtime/autoload/syntaxcomplete.vim +++ b/runtime/autoload/syntaxcomplete.vim @@ -1,8 +1,9 @@ " Vim completion script " Language: All languages, uses existing syntax highlighting rules " Maintainer: David Fishburn <fishburn@ianywhere.com> -" Version: 1.3 -" Last Change: Mon Mar 27 2006 9:29:35 PM +" Version: 2.0 +" Last Change: Fri May 05 2006 10:34:57 PM +" Usage: For detailed help, ":help ft-syntax-omni" " Set completion with CTRL-X CTRL-O to autoloaded function. " This check is in place in case this script is @@ -18,11 +19,15 @@ endif if exists('g:loaded_syntax_completion') finish endif -let g:loaded_syntax_completion = 1 +let g:loaded_syntax_completion = 20 + +" Set ignorecase to the ftplugin standard +if !exists('g:omni_syntax_ignorecase') + let g:omni_syntax_ignorecase = &ignorecase +endif " This script will build a completion list based on the syntax " elements defined by the files in $VIMRUNTIME/syntax. - let s:syn_remove_words = 'match,matchgroup=,contains,'. \ 'links to,start=,end=,nextgroup=' @@ -65,20 +70,22 @@ function! syntaxcomplete#Complete(findstart, base) let base = s:prepended . a:base - let list_idx = index(s:cache_name, &filetype, 0, &ignorecase) + let filetype = substitute(&filetype, '\.', '_', 'g') + let list_idx = index(s:cache_name, filetype, 0, &ignorecase) if list_idx > -1 let compl_list = s:cache_list[list_idx] else - let compl_list = OmniSyntaxList() - let s:cache_name = add( s:cache_name, &filetype ) - let s:cache_list = add( s:cache_list, compl_list ) + let compl_list = OmniSyntaxList() + let s:cache_name = add( s:cache_name, filetype ) + let s:cache_list = add( s:cache_list, compl_list ) endif " Return list of matches. if base =~ '\w' - let compstr = join(compl_list, ' ') - let compstr = substitute(compstr, '\<\%('.base.'\)\@!\w\+\s*', '', 'g') + let compstr = join(compl_list, ' ') + let expr = (g:omni_syntax_ignorecase==0?'\C':'').'\<\%('.base.'\)\@!\w\+\s*' + let compstr = substitute(compstr, expr, '', 'g') let compl_list = split(compstr, '\s\+') endif @@ -86,6 +93,13 @@ function! syntaxcomplete#Complete(findstart, base) endfunc function! OmniSyntaxList() + " Default to returning a dictionary, if use_dictionary is set to 0 + " a list will be returned. + " let use_dictionary = 1 + " if a:0 > 0 && a:1 != '' + " let use_dictionary = a:1 + " endif + let saveL = @l " Loop through all the syntax groupnames, and build a @@ -109,85 +123,107 @@ function! OmniSyntaxList() return [] endif + let filetype = substitute(&filetype, '\.', '_', 'g') + " Default the include group to include the requested syntax group - let syntax_group_include_{&filetype} = '' + let syntax_group_include_{filetype} = '' " Check if there are any overrides specified for this filetype - if exists('g:omni_syntax_group_include_'.&filetype) - let syntax_group_include_{&filetype} = - \ substitute( g:omni_syntax_group_include_{&filetype},'\s\+','','g') - if syntax_group_include_{&filetype} =~ '\w' - let syntax_group_include_{&filetype} = - \ substitute( syntax_group_include_{&filetype}, + if exists('g:omni_syntax_group_include_'.filetype) + let syntax_group_include_{filetype} = + \ substitute( g:omni_syntax_group_include_{filetype},'\s\+','','g') + if syntax_group_include_{filetype} =~ '\w' + let syntax_group_include_{filetype} = + \ substitute( syntax_group_include_{filetype}, \ '\s*,\s*', '\\|', 'g' \ ) endif endif " Default the exclude group to nothing - let syntax_group_exclude_{&filetype} = '' + let syntax_group_exclude_{filetype} = '' " Check if there are any overrides specified for this filetype - if exists('g:omni_syntax_group_exclude_'.&filetype) - let syntax_group_exclude_{&filetype} = - \ substitute( g:omni_syntax_group_exclude_{&filetype},'\s\+','','g') - if syntax_group_exclude_{&filetype} =~ '\w' - let syntax_group_exclude_{&filetype} = - \ substitute( syntax_group_exclude_{&filetype}, + if exists('g:omni_syntax_group_exclude_'.filetype) + let syntax_group_exclude_{filetype} = + \ substitute( g:omni_syntax_group_exclude_{filetype},'\s\+','','g') + if syntax_group_exclude_{filetype} =~ '\w' + let syntax_group_exclude_{filetype} = + \ substitute( syntax_group_exclude_{filetype}, \ '\s*,\s*', '\\|', 'g' \ ) endif endif - " Syntax rules can contain items for more than just the current - " filetype. They can contain additional items added by the user - " via autocmds or their vimrc. - " Some syntax files can be combined (html, php, jsp). - " We want only items that begin with the filetype we are interested in. - let next_group_regex = '\n' . - \ '\zs'.&filetype.'\w\+\ze'. - \ '\s\+xxx\s\+' + " Sometimes filetypes can be composite names, like c.doxygen + " Loop through each individual part looking for the syntax + " items specific to each individual filetype. let syn_list = '' - let index = 0 - let index = match(syntax_full, next_group_regex, index) - - while index > 0 - let group_name = matchstr( syntax_full, '\w\+', index ) - - let get_syn_list = 1 - " if syntax_group_include_{&filetype} == '' - " if syntax_group_exclude_{&filetype} != '' - " if '\<'.syntax_group_exclude_{&filetype}.'\>' =~ '\<'.group_name.'\>' - " let get_syn_list = 0 - " endif - " endif - " else - " if '\<'.syntax_group_include_{&filetype}.'\>' !~ '\<'.group_name.'\>' - " let get_syn_list = 0 - " endif - " endif - if syntax_group_exclude_{&filetype} != '' - if '\<'.syntax_group_exclude_{&filetype}.'\>' =~ '\<'.group_name.'\>' - let get_syn_list = 0 - endif - endif - - if get_syn_list == 1 - if syntax_group_include_{&filetype} != '' - if '\<'.syntax_group_include_{&filetype}.'\>' !~ '\<'.group_name.'\>' + let ftindex = 0 + let ftindex = match(&filetype, '\w\+', ftindex) + + while ftindex > -1 + let ft_part_name = matchstr( &filetype, '\w\+', ftindex ) + + " Syntax rules can contain items for more than just the current + " filetype. They can contain additional items added by the user + " via autocmds or their vimrc. + " Some syntax files can be combined (html, php, jsp). + " We want only items that begin with the filetype we are interested in. + let next_group_regex = '\n' . + \ '\zs'.ft_part_name.'\w\+\ze'. + \ '\s\+xxx\s\+' + let index = 0 + let index = match(syntax_full, next_group_regex, index) + + while index > -1 + let group_name = matchstr( syntax_full, '\w\+', index ) + + let get_syn_list = 1 + " if syntax_group_include_{&filetype} == '' + " if syntax_group_exclude_{&filetype} != '' + " if '\<'.syntax_group_exclude_{&filetype}.'\>' =~ '\<'.group_name.'\>' + " let get_syn_list = 0 + " endif + " endif + " else + " if '\<'.syntax_group_include_{&filetype}.'\>' !~ '\<'.group_name.'\>' + " let get_syn_list = 0 + " endif + " endif + if syntax_group_exclude_{filetype} != '' + if '\<'.syntax_group_exclude_{filetype}.'\>' =~ '\<'.group_name.'\>' let get_syn_list = 0 endif endif - endif + + if get_syn_list == 1 + if syntax_group_include_{filetype} != '' + if '\<'.syntax_group_include_{filetype}.'\>' !~ '\<'.group_name.'\>' + let get_syn_list = 0 + endif + endif + endif - if get_syn_list == 1 - " Pass in the full syntax listing, plus the group name we - " are interested in. - let extra_syn_list = s:SyntaxCSyntaxGroupItems(group_name, syntax_full) + if get_syn_list == 1 + " Pass in the full syntax listing, plus the group name we + " are interested in. + let extra_syn_list = s:SyntaxCSyntaxGroupItems(group_name, syntax_full) - let syn_list = syn_list . extra_syn_list . "\n" - endif + " if !empty(extra_syn_list) + " for elem in extra_syn_list + " let item = {'word':elem, 'kind':'t', 'info':group_name} + " let compl_list += [item] + " endfor + " endif + + let syn_list = syn_list . extra_syn_list . "\n" + endif + + let index = index + strlen(group_name) + let index = match(syntax_full, next_group_regex, index) + endwhile - let index = index + strlen(group_name) - let index = match(syntax_full, next_group_regex, index) + let ftindex = ftindex + len(ft_part_name) + let ftindex = match( &filetype, '\w\+', ftindex ) endwhile " Convert the string to a List and sort it. @@ -228,7 +264,7 @@ function! s:SyntaxCSyntaxGroupItems( group_name, syntax_full ) " \n\w - at the first newline starting with a character let syntax_group = matchstr(a:syntax_full, \ "\n".a:group_name.'\s\+xxx\s\+\zs.\{-}\ze'."\n".'\w' - \) + \ ) if syntax_group != "" " let syn_list = substitute( @l, '^.*xxx\s*\%(contained\s*\)\?', "", '' ) @@ -242,17 +278,21 @@ function! s:SyntaxCSyntaxGroupItems( group_name, syntax_full ) " contained nextgroup=... " So this will strip off the ending of lines with known " keywords. - let syn_list = substitute( syntax_group, '\<\('. - \ substitute( - \ escape( s:syn_remove_words, '\\/.*$^~[]') - \ , ',', '\\|', 'g'). - \ '\).\{-}\%($\|'."\n".'\)' - \ , "\n", 'g' ) + let syn_list = substitute( + \ syntax_group, '\<\('. + \ substitute( + \ escape(s:syn_remove_words, '\\/.*$^~[]') + \ , ',', '\\|', 'g' + \ ). + \ '\).\{-}\%($\|'."\n".'\)' + \ , "\n", 'g' + \ ) " Now strip off the newline + blank space + contained - let syn_list = substitute( syn_list, '\%(^\|\n\)\@<=\s*\<\('. - \ 'contained\)' - \ , "", 'g' ) + let syn_list = substitute( + \ syn_list, '\%(^\|\n\)\@<=\s*\<\(contained\)' + \ , "", 'g' + \ ) " There are a number of items which have non-word characters in " them, *'T_F1'*. vim.vim is one such file. diff --git a/runtime/spell/en.ascii.spl b/runtime/spell/en.ascii.spl Binary files differindex 6225c59b8..64bff2670 100644 --- a/runtime/spell/en.ascii.spl +++ b/runtime/spell/en.ascii.spl diff --git a/runtime/spell/en.latin1.sug b/runtime/spell/en.latin1.sug Binary files differindex 31924e93b..f75c28bb7 100644 --- a/runtime/spell/en.latin1.sug +++ b/runtime/spell/en.latin1.sug diff --git a/runtime/spell/en.utf-8.spl b/runtime/spell/en.utf-8.spl Binary files differindex ab4e9a970..aa9a6159e 100644 --- a/runtime/spell/en.utf-8.spl +++ b/runtime/spell/en.utf-8.spl |