SyntaxComplete : OMNI Completion based on the current syntax highlights
| script karma
Downloaded by 1994
Comments, bugs, improvements
script versions (upload new version)
|SyntaxComplete.vim is a plugin which uses the new Vim7 OMNI completion features (intellisense code completion).
SyntaxComplete.vim version 5.0 is included in the Vim 7.2 release.
SyntaxComplete.vim version 7.0 is included in the Vim 7.3 release.
SyntaxComplete.vim version 8.0 is included in the Vim 7.3 release.
SyntaxComplete.vim version 9.0 is included in the Vim 7.3 release.
SyntaxComplete.vim version 10.0 is included in the Vim 7.3 release.
SyntaxComplete.vim version 11.0 is included in the Vim 7.3 release.
SyntaxComplete.vim version 12.0 is included in the Vim 7.3 release.
SyntaxComplete.vim version 13.0 is included in the Vim 7.3 release.
What does it do:
Vim has the ability to color syntax highlight nearly 500 languages. Part of this highlighting includes knowing what keywords are part of a language. Many filetypes already have custom completion scripts written for them, the syntaxcomplete plugin provides basic completion for all other filetypes. It does this by populating the omni completion list with the text Vim already knows how to color highlight. It can be used for any filetype and provides a minimal language-sensitive completion.
There are not many languages with full blown OMNI completion scripts written in Vim. Yet, having a list of functions and keywords to complete can be very handy especially when you are working with a predefined API.
Adding the following to your .vimrc, will setup SyntaxComplete for every filetype that does not already have a language specific OMNI script:
if has("autocmd") && exists("+omnifunc")
autocmd Filetype *
\ if &omnifunc == "" |
\ setlocal omnifunc=syntaxcomplete#Complete |
It also provides some public functions so other plugin writers can pull syntax keywords (based on group names) from Vim and utilize them in any manor. Examples are included in the help files, but here is a simple example:
let myKeywords = 
let myKeywords = OmniSyntaxList( ['sqlKeyword'] )
let allItems = OmniSyntaxList(  )
Regex can also be used to identify which syntax groups to include:
let myKeywords = OmniSyntaxList( ['html\w\+', 'jquery\w\+'] )
Existing instructions can be found within Vim7 using
This plugin is new to Vim7. Improvements to the script will be uploaded here, and supplied to Bram for inclusion into future versions of Vim7.
There are many customizations which can be made per filetype via your .vimrc. See the documentation for details.
Copy syntaxcomplete.vim to:
Click on the package to download.
ip used for rating: 188.8.131.52
NF: Some syntax files (perl.vim) use the match // syntax as a mechanism to identify keywords. This update attempts to parse the match syntax and pull out syntax items which are at least 3 words or more.
BF: It is possible to have '-' as part of iskeyword, when checking for character ranges, tighten up the regex. E688: More targets than List items.
BF: Corrected which characters required escaping during substitution calls.
||Cycle through all the character ranges specified in the
iskeyword option and build a list of valid word separators.
Prior to this change, only actual characters were used,
where for example ASCII "45" == "-". If "45" were used
in iskeyword the hyphen would not be picked up.
This introduces a new option, since the character ranges
specified could be multibyte:
let g:omni_syntax_use_single_byte = 1
This by default will only allow single byte ASCII
characters to be added and an additional check to ensure
the character is printable (see documentation for isprint).
||Included in Vim 7.3 but you must pull from Vim sources. This will allow you to update to it.
- Add the check for cpo.
- Updated SyntaxCSyntaxGroupItems()
- Some additional syntax items were also allowed
on nextgroup= lines which were ignored by default.
Now these lines are processed independently.