summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2010-07-29 22:33:18 +0200
committerBram Moolenaar <Bram@vim.org>2010-07-29 22:33:18 +0200
commit40af4e3903d0701318b1b176e5fa9cdb03bb0f98 (patch)
tree339b1b610ec2160a9340bf22510c6e7a879c7f88
parent1587a1e37db85425ae77054ab681a0bbb0d1affb (diff)
downloadvim-git-40af4e3903d0701318b1b176e5fa9cdb03bb0f98.tar.gz
Updated runtime files. Add logcheck filetype plugin. (James Vega)
-rw-r--r--runtime/autoload/syntaxcomplete.vim185
-rw-r--r--runtime/doc/change.txt5
-rw-r--r--runtime/doc/helphelp.txt13
-rw-r--r--runtime/doc/todo.txt2
-rw-r--r--runtime/filetype.vim5
-rw-r--r--runtime/ftplugin/logcheck.vim17
6 files changed, 161 insertions, 66 deletions
diff --git a/runtime/autoload/syntaxcomplete.vim b/runtime/autoload/syntaxcomplete.vim
index c887bd5a1..7b96bfd77 100644
--- 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(findstart, base)
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
diff --git a/runtime/doc/change.txt b/runtime/doc/change.txt
index 3a1c74faf..8a5d36181 100644
--- 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 {motion} moves over.
: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
diff --git a/runtime/doc/helphelp.txt b/runtime/doc/helphelp.txt
index c02b45a93..aa66b03f8 100644
--- 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 @@ Help on help files *helphelp*
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).
diff --git a/runtime/doc/todo.txt b/runtime/doc/todo.txt
index 55a8b4c5c..bacf520c4 100644
--- a/runtime/doc/todo.txt
+++ b/runtime/doc/todo.txt
@@ -44,6 +44,8 @@ ftplugin/mupad.vim should not source AppendMatchGroup.vim, it should use an
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)
diff --git a/runtime/filetype.vim b/runtime/filetype.vim
index 369cabcb3..e4796c149 100644
--- 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')
diff --git a/runtime/ftplugin/logcheck.vim b/runtime/ftplugin/logcheck.vim
new file mode 100644
index 000000000..765f6b471
--- /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