changeset 2434:86532ee3ea41 vim73

Updated runtime files. Add logcheck filetype plugin. (James Vega)
author Bram Moolenaar <bram@vim.org>
date Thu, 29 Jul 2010 22:33:18 +0200
parents 98b9a6b9e7d5
children 291edb23ab17
files runtime/autoload/syntaxcomplete.vim runtime/doc/change.txt runtime/doc/helphelp.txt runtime/doc/todo.txt runtime/filetype.vim runtime/ftplugin/logcheck.vim
diffstat 6 files changed, 161 insertions(+), 66 deletions(-) [+]
line wrap: on
line diff
--- a/runtime/autoload/syntaxcomplete.vim
+++ b/runtime/autoload/syntaxcomplete.vim
@@ -1,14 +1,34 @@
 " Vim completion script
 " Language:    All languages, uses existing syntax highlighting rules
 " Maintainer:  David Fishburn <dfishburn dot vim at gmail dot com>
-" Version:     5.0
-" Last Change: 2010 Jan 31
+" Version:     7.0
+" Last Change: 2010 Jul 29
 " Usage:       For detailed help, ":help ft-syntax-omni" 
 
 " History
+"
+" Version 7.0
+"     Updated syntaxcomplete#OmniSyntaxList()
+"         - Looking up the syntax groups defined from a syntax file
+"           looked for only 1 format of {filetype}GroupName, but some 
+"           syntax writers use this format as well:
+"               {b:current_syntax}GroupName
+"           OmniSyntaxList() will now check for both if the first
+"           method does not find a match.
+"
+" Version 6.0
+"     Added syntaxcomplete#OmniSyntaxList()
+"         - Allows other plugins to use this for their own 
+"           purposes.
+"         - It will return a List of all syntax items for the
+"           syntax group name passed in.  
+"         - XPTemplate for SQL will use this function via the 
+"           sqlcomplete plugin to populate a Choose box.
+"
 " Version 5.0
-"     When processing a list of syntax groups, the final group
-"     was missed in function SyntaxCSyntaxGroupItems.
+"     Updated SyntaxCSyntaxGroupItems()
+"         - When processing a list of syntax groups, the final group
+"           was missed in function SyntaxCSyntaxGroupItems.
 "
 " Set completion with CTRL-X CTRL-O to autoloaded function.
 " This check is in place in case this script is
@@ -24,7 +44,7 @@ endif
 if exists('g:loaded_syntax_completion')
     finish 
 endif
-let g:loaded_syntax_completion = 40
+let g:loaded_syntax_completion = 70
 
 " Set ignorecase to the ftplugin standard
 " This is the default setting, but if you define a buffer local
@@ -128,7 +148,30 @@ function! syntaxcomplete#Complete(findst
     return compl_list
 endfunc
 
-function! OmniSyntaxList()
+function! syntaxcomplete#OmniSyntaxList(...)
+    if a:0 > 0
+        let parms = []
+        if 3 == type(a:1) 
+            let parms = a:1
+        elseif 1 == type(a:1)
+            let parms = split(a:1, ',')
+        endif
+        return OmniSyntaxList( parms )
+    else
+        return OmniSyntaxList()
+    endif
+endfunc
+
+function! OmniSyntaxList(...)
+    let list_parms = []
+    if a:0 > 0
+        if 3 == type(a:1) 
+            let list_parms = a:1
+        elseif 1 == type(a:1)
+            let list_parms = split(a:1, ',')
+        endif
+    endif
+
     " Default to returning a dictionary, if use_dictionary is set to 0
     " a list will be returned.
     " let use_dictionary = 1
@@ -157,16 +200,40 @@ function! OmniSyntaxList()
     endif
 
     let saveL = @l
+    let filetype = substitute(&filetype, '\.', '_', 'g')
     
+    if empty(list_parms)
+        " Default the include group to include the requested syntax group
+        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') 
+            let list_parms = split(g:omni_syntax_group_include_{filetype}, ',')
+            if syntax_group_include_{filetype} =~ '\w'
+                let syntax_group_include_{filetype} = 
+                            \ substitute( syntax_group_include_{filetype}, 
+                            \ '\s*,\s*', '\\|', 'g'
+                            \ )
+            endif
+        endif
+    else
+        " A specific list was provided, use it
+    endif
+
     " Loop through all the syntax groupnames, and build a
     " syntax file which contains these names.  This can 
     " work generically for any filetype that does not already
     " have a plugin defined.
     " This ASSUMES the syntax groupname BEGINS with the name
     " of the filetype.  From my casual viewing of the vim7\syntax 
-    " directory.
+    " directory this is true for almost all syntax definitions.
+    " As an example, the SQL syntax groups have this pattern:
+    "     sqlType
+    "     sqlOperators
+    "     sqlKeyword ...
     redir @l
-    silent! exec 'syntax list '
+    silent! exec 'syntax list '.join(list_parms)
     redir END
 
     let syntax_full = "\n".@l
@@ -181,31 +248,23 @@ function! OmniSyntaxList()
 
     let filetype = substitute(&filetype, '\.', '_', 'g')
 
-    " Default the include group to include the requested syntax group
-    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}, 
-                        \ '\s*,\s*', '\\|', 'g'
-                        \ )
-        endif
-    endif
-
-    " Default the exclude group to nothing
-    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}, 
-                        \ '\s*,\s*', '\\|', 'g'
-                        \ )
+    let list_exclude_groups = []
+    if a:0 > 0 
+        " Do nothing since we have specific a specific list of groups
+    else
+        " Default the exclude group to nothing
+        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') 
+            let list_exclude_groups = split(g:omni_syntax_group_exclude_{filetype}, ',')
+            if syntax_group_exclude_{filetype} =~ '\w' 
+                let syntax_group_exclude_{filetype} = 
+                            \ substitute( syntax_group_exclude_{filetype}, 
+                            \ '\s*,\s*', '\\|', 'g'
+                            \ )
+            endif
         endif
     endif
 
@@ -230,47 +289,51 @@ function! OmniSyntaxList()
         let index    = 0
         let index    = match(syntax_full, next_group_regex, index)
 
+        if index == -1 && exists('b:current_syntax') && ft_part_name != b:current_syntax
+            " There appears to be two standards when writing syntax files.
+            " Either items begin as:
+            "     syn keyword {filetype}Keyword         values ...
+            "     let b:current_syntax = "sql"
+            "     let b:current_syntax = "sqlanywhere"
+            " Or
+            "     syn keyword {syntax_filename}Keyword  values ...
+            "     let b:current_syntax = "mysql"
+            " So, we will make the format of finding the syntax group names
+            " a bit more flexible and look for both if the first fails to 
+            " find a match.
+            let next_group_regex = '\n' .
+                        \ '\zs'.b:current_syntax.'\w\+\ze'.
+                        \ '\s\+xxx\s\+' 
+            let index    = 0
+            let index    = match(syntax_full, next_group_regex, index)
+        endif
+
         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.'\>'
+            for exclude_group_name in list_exclude_groups
+                if '\<'.exclude_group_name.'\>' =~ '\<'.group_name.'\>'
+                    let get_syn_list = 0
+                endif
+            endfor
+        
+            " This code is no longer needed in version 6.0 since we have
+            " augmented the syntax list command to only retrieve the syntax 
+            " groups we are interested in.
+            "
+            " if get_syn_list == 1
+            "     if syntax_group_include_{filetype} != ''
+            "         if '\<'.syntax_group_include_{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 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 !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
 
--- a/runtime/doc/change.txt
+++ b/runtime/doc/change.txt
@@ -1,4 +1,4 @@
-*change.txt*    For Vim version 7.3c.  Last change: 2010 Mar 23
+*change.txt*    For Vim version 7.3c.  Last change: 2010 Jul 29
 
 
 		  VIM REFERENCE MANUAL    by Bram Moolenaar
@@ -1245,7 +1245,8 @@ gq{motion}		Format the lines that {motio
 				:nnoremap Q gq
 
 gqgq							*gqgq* *gqq*
-gqq			Format the current line.  {not in Vi}
+gqq			Format the current line.  With a count format that
+			many lines.  {not in Vi}
 
 							*v_gq*
 {Visual}gq		Format the highlighted text.  (for {Visual} see
--- a/runtime/doc/helphelp.txt
+++ b/runtime/doc/helphelp.txt
@@ -1,4 +1,4 @@
-*helphelp.txt*	For Vim version 7.3c.  Last change: 2008 Jul 21
+*helphelp.txt*	For Vim version 7.3c.  Last change: 2010 Jul 29
 
 
 		  VIM REFERENCE MANUAL    by Bram Moolenaar
@@ -60,11 +60,20 @@ 1. Help commands					*online-help*
 			If there are several matches, you can have them listed
 			by hitting CTRL-D.  Example: >
 				:help cont<Ctrl-D>
-<			To use a regexp |pattern|, first do ":help" and then
+
+<			Instead of typing ":help CTRL-V" to search for help
+			for CTRL-V you can type: >
+				:help ^V
+<			This also works together with other characters, for
+			example to find help for CTRL-V in Insert mode: >
+				:help i^V
+<
+			To use a regexp |pattern|, first do ":help" and then
 			use ":tag {pattern}" in the help window.  The
 			":tnext" command can then be used to jump to other
 			matches, "tselect" to list matches and choose one. >
 				:help index| :tse z.
+
 <			When there is no argument you will see matches for
 			"help", to avoid listing all possible matches (that
 			would be very slow).
--- a/runtime/doc/todo.txt
+++ b/runtime/doc/todo.txt
@@ -44,6 +44,8 @@ ftplugin/mupad.vim should not source App
 autoload function.
 Same for indent/GenericIndent.vim
 
+Uninspected issues on http://scan.coverity.com/rung2.html
+
 Before release 7.3:
 - Rename vim73 branch to default (hints: Xavier de Gaye, 2010 May 23)
 
--- a/runtime/filetype.vim
+++ b/runtime/filetype.vim
@@ -1,7 +1,7 @@
 " Vim support file to detect file types
 "
 " Maintainer:	Bram Moolenaar <Bram@vim.org>
-" Last Change:	2010 Jul 26
+" Last Change:	2010 Jul 29
 
 " Listen very carefully, I will say this only once
 if exists("did_load_filetypes")
@@ -2403,6 +2403,9 @@ au! BufNewFile,BufRead *jarg*
 " Kconfig
 au BufNewFile,BufRead Kconfig.*			call s:StarSetf('kconfig')
 
+" Logcheck
+au BufNewFile,BufRead /etc/logcheck/*.d*/*	call s:StarSetf('logcheck')
+
 " Makefile
 au BufNewFile,BufRead [mM]akefile*		call s:StarSetf('make')
 
new file mode 100644
--- /dev/null
+++ b/runtime/ftplugin/logcheck.vim
@@ -0,0 +1,17 @@
+" Vim filetype plugin file
+" Language:    Logcheck
+" Maintainer:  Debian Vim Maintainers <pkg-vim-maintainers@lists.alioth.debian.org>
+" Last Change: 2010 Jul 29
+" License:     GNU GPL, version 2.0
+" URL: http://hg.debian.org/hg/pkg-vim/vim/file/unstable/runtime/ftplugin/logcheck.vim
+
+if exists("b:did_ftplugin")
+    finish
+endif
+let b:did_ftplugin = 1
+
+let b:undo_ftplugin = "setl fo<"
+
+" Do not hard-wrap non-comment lines since each line is a self-contained
+" regular expression
+setlocal formatoptions-=t