updated for version 7.0b

This commit is contained in:
Bram Moolenaar
2006-03-24 22:46:53 +00:00
parent c01140a1a0
commit 76b92b2830
102 changed files with 1377 additions and 1810 deletions

View File

@ -1,7 +1,7 @@
" Vim completion script
" Language: C
" Maintainer: Bram Moolenaar <Bram@vim.org>
" Last Change: 2006 Mar 19
" Last Change: 2006 Mar 24
" This function is used for the 'omnifunc' option.
@ -166,9 +166,11 @@ function! ccomplete#Complete(findstart, base)
let res = []
for i in range(len(diclist))
" New ctags has the "typename" field.
" New ctags has the "typeref" field. Patched version has "typename".
if has_key(diclist[i], 'typename')
call extend(res, s:StructMembers(diclist[i]['typename'], items[1:], 1))
elseif has_key(diclist[i], 'typeref')
call extend(res, s:StructMembers(diclist[i]['typeref'], items[1:], 1))
endif
" For a variable use the command, which must be a search pattern that
@ -232,10 +234,9 @@ function! s:Tag2item(val)
let res['extra'] = s:Tagcmd2extra(a:val['cmd'], a:val['name'], a:val['filename'])
" Use the whole search command as the "info" entry.
let s = matchstr(a:val['cmd'], '/^\s*\zs.*\ze$/')
let s = s:Dict2info(a:val)
if s != ''
let res['info'] = substitute(s, '\\\(.\)', '\1', 'g')
let res['info'] = s
endif
let res['tagline'] = ''
@ -253,6 +254,51 @@ function! s:Tag2item(val)
return res
endfunction
" Use all the items in dictionary for the "info" entry.
function! s:Dict2info(dict)
let info = ''
for k in sort(keys(a:dict))
let info .= k . repeat(' ', 10 - len(k))
if k == 'cmd'
let info .= substitute(matchstr(a:dict['cmd'], '/^\s*\zs.*\ze$/'), '\\\(.\)', '\1', 'g')
else
let info .= a:dict[k]
endif
let info .= "\n"
endfor
return info
endfunc
" Parse a tag line and return a dictionary with items like taglist()
function! s:ParseTagline(line)
let l = split(a:line, "\t")
let d = {}
if len(l) >= 3
let d['name'] = l[0]
let d['filename'] = l[1]
let d['cmd'] = l[2]
let n = 2
if l[2] =~ '^/'
" Find end of cmd, it may contain Tabs.
while n < len(l) && l[n] !~ '/;"$'
let n += 1
let d['cmd'] .= " " . l[n]
endwhile
endif
for i in range(n + 1, len(l) - 1)
if l[i] == 'file:'
let d['static'] = 1
elseif l[i] !~ ':'
let d['kind'] = l[i]
else
let d[matchstr(l[i], '[^:]*')] = matchstr(l[i], ':\zs.*')
endif
endfor
endif
return d
endfunction
" Turn a match item "val" into an item for completion.
" "val['match']" is the matching item.
" "val['tagline']" is the tagline in which the last part was found.
@ -265,10 +311,10 @@ function! s:Tagline2item(val, brackets)
" Use info from Tag2item().
let res['info'] = a:val['info']
else
" Use the whole search command as the "info" entry.
let s = matchstr(line, '\t/^\s*\zs.*\ze$/')
" Parse the tag line and add each part to the "info" entry.
let s = s:Dict2info(s:ParseTagline(line))
if s != ''
let res['info'] = substitute(s, '\\\(.\)', '\1', 'g')
let res['info'] = s
endif
endif
@ -348,7 +394,11 @@ function! s:Nextitem(lead, items, depth, all)
for tagidx in range(len(diclist))
let item = diclist[tagidx]
" New ctags has the "typename" field.
" New ctags has the "typeref" field. Patched version has "typename".
if has_key(item, 'typeref')
call extend(res, s:StructMembers(item['typeref'], a:items, a:all))
continue
endif
if has_key(item, 'typename')
call extend(res, s:StructMembers(item['typename'], a:items, a:all))
continue
@ -496,11 +546,16 @@ function! s:SearchMembers(matches, items, all)
if has_key(a:matches[i], 'dict')
if has_key(a:matches[i].dict, 'typename')
let typename = a:matches[i].dict['typename']
elseif has_key(a:matches[i].dict, 'typeref')
let typename = a:matches[i].dict['typeref']
endif
let line = "\t" . a:matches[i].dict['cmd']
else
let line = a:matches[i]['tagline']
let e = matchend(line, '\ttypename:')
if e < 0
let e = matchend(line, '\ttyperef:')
endif
if e > 0
" Use typename field
let typename = matchstr(line, '[^\t]*', e)

View File

@ -1,4 +1,4 @@
*arabic.txt* For Vim version 7.0aa. Last change: 2005 Mar 29
*arabic.txt* For Vim version 7.0b. Last change: 2005 Mar 29
VIM REFERENCE MANUAL by Nadim Shaikli

View File

@ -1,4 +1,4 @@
*eval.txt* For Vim version 7.0aa. Last change: 2006 Mar 22
*eval.txt* For Vim version 7.0b. Last change: 2006 Mar 22
VIM REFERENCE MANUAL by Bram Moolenaar

View File

@ -1,4 +1,4 @@
*farsi.txt* For Vim version 7.0aa. Last change: 2005 Mar 29
*farsi.txt* For Vim version 7.0b. Last change: 2005 Mar 29
VIM REFERENCE MANUAL by Mortaza Ghassab Shiran

View File

@ -1,4 +1,4 @@
*filetype.txt* For Vim version 7.0aa. Last change: 2006 Mar 21
*filetype.txt* For Vim version 7.0b. Last change: 2006 Mar 24
VIM REFERENCE MANUAL by Bram Moolenaar
@ -549,10 +549,10 @@ If the first line of a *.tex file has the form >
%&<format>
then this determined the file type: plaintex (for plain TeX), context (for
ConTeXt), or tex (for LaTeX). Otherwise, the file is searched for keywords to
choose context or tex. If no keywords are found, it defaults to tex. You can
change the default by defining the variable g:tex_flavor to the format (not
the file type) you use most: plain or context or latex. (Currently no other
formats are recognized.)
choose context or tex. If no keywords are found, it defaults to plaintex.
You can change the default by defining the variable g:tex_flavor to the format
(not the file type) you use most: plain or context or latex. (Currently no
other formats are recognized.)
vim:tw=78:ts=8:ft=help:norl:

View File

@ -1,4 +1,6 @@
*getscript.txt* Get the Latest VimScripts Dec 23, 2005
*getscript.txt* For Vim version 7.0b. Last change: 2006 Mar 24
Get the Latest VimScripts
Authors: Charles E. Campbell, Jr. <NdrOchip@ScampbellPfamilyA.Mbiz>
(remove NOSPAM from the email address)
@ -23,7 +25,7 @@ Copyright: (c) 2004-2005 by Charles E. Campbell, Jr.
==============================================================================
2. GetLatestVimScripts Usage *getlatestvimscripts* *getscript* *glvs*
2. GetLatestVimScripts Usage *getlatestvimscripts* *getscript* *glvs*
While in vim, type
>

View File

@ -1,4 +1,4 @@
*hebrew.txt* For Vim version 7.0aa. Last change: 2003 May 11
*hebrew.txt* For Vim version 7.0b. Last change: 2003 May 11
VIM REFERENCE MANUAL by Ron Aaron (and Avner Lottem)

View File

@ -1,4 +1,4 @@
*howto.txt* For Vim version 7.0aa. Last change: 2001 Sep 03
*howto.txt* For Vim version 7.0b. Last change: 2001 Sep 03
VIM REFERENCE MANUAL by Bram Moolenaar

View File

@ -1,4 +1,4 @@
*intro.txt* For Vim version 7.0aa. Last change: 2005 Sep 01
*intro.txt* For Vim version 7.0b. Last change: 2005 Sep 01
VIM REFERENCE MANUAL by Bram Moolenaar

View File

@ -1,4 +1,4 @@
*os_amiga.txt* For Vim version 7.0aa. Last change: 2005 Mar 29
*os_amiga.txt* For Vim version 7.0b. Last change: 2005 Mar 29
VIM REFERENCE MANUAL by Bram Moolenaar

View File

@ -1,4 +1,4 @@
*os_dos.txt* For Vim version 7.0aa. Last change: 2006 Feb 14
*os_dos.txt* For Vim version 7.0b. Last change: 2006 Feb 14
VIM REFERENCE MANUAL by Bram Moolenaar

View File

@ -1,4 +1,4 @@
*os_win32.txt* For Vim version 7.0aa. Last change: 2005 Mar 29
*os_win32.txt* For Vim version 7.0b. Last change: 2005 Mar 29
VIM REFERENCE MANUAL by George Reilly

View File

@ -1,4 +1,4 @@
*pattern.txt* For Vim version 7.0aa. Last change: 2006 Mar 06
*pattern.txt* For Vim version 7.0b. Last change: 2006 Mar 06
VIM REFERENCE MANUAL by Bram Moolenaar

View File

@ -1,4 +1,4 @@
*pi_spec.txt* For Vim version 7.0aa. Last change: 2005 Oct 03
*pi_spec.txt* For Vim version 7.0b. Last change: 2005 Oct 03
by Gustavo Niemeyer ~

View File

@ -1,4 +1,4 @@
*quickfix.txt* For Vim version 7.0aa. Last change: 2006 Mar 23
*quickfix.txt* For Vim version 7.0b. Last change: 2006 Mar 24
VIM REFERENCE MANUAL by Bram Moolenaar
@ -225,6 +225,14 @@ command with 'l'.
<
*:lex* *:lexpr*
:lex[pr][!] {expr} Same as ":cexpr", except the location list for the
current window is used instead of the quickfix list.
*:cgete* *:cgetexpr*
:cgete[xpr][!] {expr} Create a quickfix list using the result of {expr}.
Just like ":cexpr", but don't jump to the first error.
*:lgete* *:lgetexpr*
:lgete[xpr][!] {expr} Same as ":cgetexpr", except the location list for the
current window is used instead of the quickfix list.
*:cad* *:caddexpr*
@ -238,14 +246,6 @@ command with 'l'.
<
*:lad* *:laddexpr*
:lad[dexpr][!] {expr} Same as ":caddexpr", except the location list for the
current window is used instead of the quickfix list.
*:cgete* *:cgetexpr*
:cgete[xpr][!] {expr} Create a quickfix list using the result of {expr}.
Just like ":cexpr", but don't jump to the first error.
*:lgete* *:lgetexpr*
:lgete[xpr][!] {expr} Same as ":cgetexpr", except the location list for the
current window is used instead of the quickfix list.
*:cl* *:clist*

View File

@ -1,4 +1,4 @@
*quotes.txt* For Vim version 7.0aa. Last change: 2005 Apr 04
*quotes.txt* For Vim version 7.0b. Last change: 2005 Apr 04
VIM REFERENCE MANUAL by Bram Moolenaar

View File

@ -1,4 +1,4 @@
*remote.txt* For Vim version 7.0aa. Last change: 2006 Mar 11
*remote.txt* For Vim version 7.0b. Last change: 2006 Mar 11
VIM REFERENCE MANUAL by Bram Moolenaar

View File

@ -1,4 +1,4 @@
*repeat.txt* For Vim version 7.0aa. Last change: 2006 Mar 21
*repeat.txt* For Vim version 7.0b. Last change: 2006 Mar 21
VIM REFERENCE MANUAL by Bram Moolenaar

View File

@ -1,4 +1,4 @@
*scroll.txt* For Vim version 7.0aa. Last change: 2005 Dec 16
*scroll.txt* For Vim version 7.0b. Last change: 2005 Dec 16
VIM REFERENCE MANUAL by Bram Moolenaar

View File

@ -1,4 +1,4 @@
*spell.txt* For Vim version 7.0aa. Last change: 2006 Mar 10
*spell.txt* For Vim version 7.0b. Last change: 2006 Mar 10
VIM REFERENCE MANUAL by Bram Moolenaar

View File

@ -1,4 +1,4 @@
*sql.txt* For Vim version 7.0aa. Last change: Fri Jan 06 2006 8:09:25 AM
*sql.txt* For Vim version 7.0b. Last change: Fri Jan 06 2006 8:09:25 AM
by David Fishburn

View File

@ -1,4 +1,4 @@
*starting.txt* For Vim version 7.0aa. Last change: 2006 Mar 05
*starting.txt* For Vim version 7.0b. Last change: 2006 Mar 05
VIM REFERENCE MANUAL by Bram Moolenaar

View File

@ -1,4 +1,4 @@
*syntax.txt* For Vim version 7.0aa. Last change: 2006 Mar 12
*syntax.txt* For Vim version 7.0b. Last change: 2006 Mar 12
VIM REFERENCE MANUAL by Bram Moolenaar

View File

@ -1,4 +1,4 @@
*tagsrch.txt* For Vim version 7.0aa. Last change: 2006 Feb 24
*tagsrch.txt* For Vim version 7.0b. Last change: 2006 Feb 24
VIM REFERENCE MANUAL by Bram Moolenaar

View File

@ -1,4 +1,4 @@
*todo.txt* For Vim version 7.0aa. Last change: 2006 Mar 23
*todo.txt* For Vim version 7.0b. Last change: 2006 Mar 24
VIM REFERENCE MANUAL by Bram Moolenaar
@ -30,8 +30,18 @@ be worked on, but only if you sponsor Vim development. See |sponsor|.
*known-bugs*
-------------------- Known bugs and current work -----------------------
Include patch for recognizing TeX flavor. (Benji Fisher)
And new tex.vim and plaintex.vim.
The 16 bit DOS version doesn't link because too much static memory is used.
Drop it?
test61 sometimes fails, probably because of timing variations.
Check version7.txt for:
- new syntax files and other runtime files.
- new functions
- new options
- etc.
Add more tests for all new functionality in Vim 7. Especially new functions.
Win32: Describe how to do debugging. (George Reilly)
@ -44,24 +54,12 @@ Mac unicode patch (Da Woon Jung, Eckehard Berns):
- With 'nopaste' pasting is wrong, with 'paste' Command-V doesn't work.
(Alan Schmitt)
Darren is including the patch in ctags. Test it when it's ready. Change
"typename" to "typeref" in C complete code.
HTML indenting can be slow. Caused by using searchpair(). Can search() be
used instead?
ccomplete: use "signature:" field from tags file when it's present.
Or list all the fields? (Martin Stubenschrott)
Add more tests for all new functionality in Vim 7. Especially new functions.
Add text in user manual for using the undo tree. Example with finding the
text of a previous change.
Links in docs to GetLatestVimScripts (getscript) plugin.
Darren is including the patch in ctags. Test it when it's ready.
Awaiting updated patches:
9 HTML indenting can be slow. Caused by using searchpair(). Can search()
be used instead?
8 Add ":n" to fnamemodify(): normalize path, remove "../" when possible.
Aric Blumer has a patch for this.
He will update the patch for 6.3.

View File

@ -1,4 +1,4 @@
*usr_01.txt* For Vim version 7.0aa. Last change: 2005 Apr 01
*usr_01.txt* For Vim version 7.0b. Last change: 2005 Apr 01
VIM USER MANUAL - by Bram Moolenaar

View File

@ -1,4 +1,4 @@
*usr_04.txt* For Vim version 7.0aa. Last change: 2005 Apr 01
*usr_04.txt* For Vim version 7.0b. Last change: 2005 Apr 01
VIM USER MANUAL - by Bram Moolenaar

View File

@ -1,4 +1,4 @@
*usr_05.txt* For Vim version 7.0aa. Last change: 2005 Oct 04
*usr_05.txt* For Vim version 7.0b. Last change: 2006 Mar 24
VIM USER MANUAL - by Bram Moolenaar
@ -300,10 +300,13 @@ GETTING A GLOBAL PLUGIN
Where can you find plugins?
- Some come with Vim. You can find them in the directory $VIMRUNTIME/macros
and its sub-directories.
- Download from the net, check out http://vim.sf.net.
- Download from the net. There is a large collection on http://www.vim.org.
- They are sometimes posted in a Vim |maillist|.
- You could write one yourself, see |write-plugin|.
Some plugins come as a vimball archive, see |vimball|.
Some plugins can be updated automatically, see |getscript|.
USING A GLOBAL PLUGIN

View File

@ -1,4 +1,4 @@
*usr_06.txt* For Vim version 7.0aa. Last change: 2006 Feb 16
*usr_06.txt* For Vim version 7.0b. Last change: 2006 Feb 16
VIM USER MANUAL - by Bram Moolenaar

View File

@ -1,4 +1,4 @@
*usr_07.txt* For Vim version 7.0aa. Last change: 2005 Apr 01
*usr_07.txt* For Vim version 7.0b. Last change: 2005 Apr 01
VIM USER MANUAL - by Bram Moolenaar

View File

@ -1,4 +1,4 @@
*usr_11.txt* For Vim version 7.0aa. Last change: 2005 Jun 09
*usr_11.txt* For Vim version 7.0b. Last change: 2005 Jun 09
VIM USER MANUAL - by Bram Moolenaar

View File

@ -1,4 +1,4 @@
*usr_12.txt* For Vim version 7.0aa. Last change: 2006 Feb 26
*usr_12.txt* For Vim version 7.0b. Last change: 2006 Feb 26
VIM USER MANUAL - by Bram Moolenaar

View File

@ -1,4 +1,4 @@
*usr_20.txt* For Vim version 7.0aa. Last change: 2005 Apr 01
*usr_20.txt* For Vim version 7.0b. Last change: 2005 Apr 01
VIM USER MANUAL - by Bram Moolenaar

View File

@ -1,4 +1,4 @@
*usr_23.txt* For Vim version 7.0aa. Last change: 2005 Apr 01
*usr_23.txt* For Vim version 7.0b. Last change: 2005 Apr 01
VIM USER MANUAL - by Bram Moolenaar

View File

@ -1,4 +1,4 @@
*usr_27.txt* For Vim version 7.0aa. Last change: 2005 Feb 08
*usr_27.txt* For Vim version 7.0b. Last change: 2005 Feb 08
VIM USER MANUAL - by Bram Moolenaar

View File

@ -1,4 +1,4 @@
*usr_28.txt* For Vim version 7.0aa. Last change: 2005 Apr 01
*usr_28.txt* For Vim version 7.0b. Last change: 2005 Apr 01
VIM USER MANUAL - by Bram Moolenaar

View File

@ -1,4 +1,4 @@
*usr_30.txt* For Vim version 7.0aa. Last change: 2005 Apr 01
*usr_30.txt* For Vim version 7.0b. Last change: 2005 Apr 01
VIM USER MANUAL - by Bram Moolenaar

View File

@ -1,4 +1,4 @@
*usr_31.txt* For Vim version 7.0aa. Last change: 2006 Feb 28
*usr_31.txt* For Vim version 7.0b. Last change: 2006 Mar 24
VIM USER MANUAL - by Bram Moolenaar
@ -15,7 +15,7 @@ between alternatives. Use keyboard shortcuts to access menu items quickly.
|31.4| Vim window position and size
|31.5| Various
Next chapter: |usr_40.txt| Make new commands
Next chapter: |usr_32.txt| The undo tree
Previous chapter: |usr_30.txt| Editing programs
Table of contents: |usr_toc.txt|
@ -262,6 +262,6 @@ another font size, for example.
==============================================================================
Next chapter: |usr_40.txt| Make new commands
Next chapter: |usr_32.txt| The undo tree
Copyright: see |manual-copyright| vim:tw=78:ts=8:ft=help:norl:

View File

@ -1,4 +1,4 @@
*usr_40.txt* For Vim version 7.0aa. Last change: 2005 Apr 01
*usr_40.txt* For Vim version 7.0b. Last change: 2006 Mar 24
VIM USER MANUAL - by Bram Moolenaar
@ -14,7 +14,7 @@ Autocommands make it possible to execute commands automatically.
|40.3| Autocommands
Next chapter: |usr_41.txt| Write a Vim script
Previous chapter: |usr_31.txt| Exploiting the GUI
Previous chapter: |usr_32.txt| The undo tree
Table of contents: |usr_toc.txt|
==============================================================================

View File

@ -1,4 +1,4 @@
*various.txt* For Vim version 7.0aa. Last change: 2006 Mar 21
*various.txt* For Vim version 7.0b. Last change: 2006 Mar 21
VIM REFERENCE MANUAL by Bram Moolenaar

View File

@ -1,4 +1,4 @@
*version7.txt* For Vim version 7.0aa. Last change: 2006 Mar 23
*version7.txt* For Vim version 7.0b. Last change: 2006 Mar 24
VIM REFERENCE MANUAL by Bram Moolenaar
@ -628,13 +628,13 @@ Win32: The ":winpos" command now also works in the console. (Vipin Aravind)
don't jump to the first error. (Yegappan Lakshmanan).
|:lfile| Like |:cfile| but use the location list.
|:lgetbuffer| Like |:cgetbuffer| but use the location list.
|:lgetexpr| Like |:cgetexpr| but use the location list.
|:lgetfile| Like |:cgetfile| but use the location list.
|:laddfile| Like |:caddfile| but use the location list.
|:lbuffer| Like |:cbuffer| but use the location list.
|:lgetbuffer| Like |:cgetbuffer| but use the location list.
|:laddbuffer| Like |:caddbuffer| but use the location list.
|:lexpr| Like |:cexpr| but use the location list.
|:lgetexpr| Like |:cgetexpr| but use the location list.
|:laddexpr| Like |:caddexpr| but use the location list.
|:ll| Like |:cc| but use the location list.
|:llist| Like |:clist| but use the location list.

View File

@ -1,4 +1,7 @@
*vimball.txt* Vimball Archiver Mar 20, 2006
*vimball.txt* For Vim version 7.0b. Last change: 2006 Mar 24
Vimball Archiver
Author: Charles E. Campbell, Jr. <NdrOchip@ScampbellPfamily.AbizM>
(remove NOSPAM from Campbell's email first)
Copyright: (c) 2004-2006 by Charles E. Campbell, Jr. *Vimball-copyright*

View File

@ -1,4 +1,4 @@
*windows.txt* For Vim version 7.0aa. Last change: 2006 Mar 11
*windows.txt* For Vim version 7.0b. Last change: 2006 Mar 11
VIM REFERENCE MANUAL by Bram Moolenaar

View File

@ -1,4 +1,4 @@
*workshop.txt* For Vim version 7.0aa. Last change: 2005 Mar 29
*workshop.txt* For Vim version 7.0b. Last change: 2005 Mar 29
VIM REFERENCE MANUAL by Gordon Prieur

View File

@ -1,7 +1,7 @@
" Vim support file to detect file types
"
" Maintainer: Bram Moolenaar <Bram@vim.org>
" Last Change: 2006 Mar 23
" Last Change: 2006 Mar 24
" Listen very carefully, I will say this only once
if exists("did_load_filetypes")
@ -1664,30 +1664,56 @@ au BufNewFile,BufRead *.ti setf terminfo
au BufNewFile,BufRead *.latex,*.sty,*.dtx,*.ltx,*.bbl setf tex
au BufNewFile,BufRead *.tex call s:FTtex()
" Choose context, plaintex, or tex (LaTeX) based on these rules:
" 1. Check the first line of the file for "%&<format>".
" 2. Check the first 1000 non-comment lines for LaTeX or ConTeXt keywords.
" 3. Default to "latex" or to g:tex_flavor, can be set in user's vimrc.
fun! s:FTtex()
let lnum = 1
let checked = 0
while checked < 25 && lnum < line("$")
let line = getline(lnum)
if line !~ '^\s*%'
if line =~ '^\s*\\\%(documentclass\>\|usepackage\>\|begin{\|newcommand\>\|renewcommand\>\)'
setf tex
return
elseif line =~ '^\s*\\\%(start\a\+\|setup\a\+\|usemodule\|enablemode\|enableregime\|setvariables\|useencoding\|usesymbols\|stelle\a\+\|verwende\a\+\|stel\a\+\|gebruik\a\+\|usa\a\+\|imposta\a\+\|regle\a\+\|utilisemodule\)\>'
setf context
return
endif
let checked = checked + 1
let firstline = getline(1)
if firstline =~ '^%&\s*\a\+'
let format = tolower(matchstr(firstline, '\a\+'))
let format = substitute(format, 'pdf', '', '')
if format == 'tex'
let format = 'plain'
endif
let lnum = lnum + 1
endwhile
" Didn't recognize anything, guess.
if exists("g:tex_flavour") && g:tex_flavour == "context"
setf context
else
" Default value, may be changed later:
let format = exists("g:tex_flavor") ? g:tex_flavor : 'plain'
" Save position, go to the top of the file, find first non-comment line.
let save_cursor = getpos('.')
call cursor(1,1)
let firstNC = search('^\s*[^[:space:]%]', 'c', 1000)
if firstNC " Check the next thousand lines for a LaTeX or ConTeXt keyword.
let lpat = 'documentclass\>\|usepackage\>\|begin{\|newcommand\>\|renewcommand\>'
let cpat = 'start\a\+\|setup\a\+\|usemodule\|enablemode\|enableregime\|setvariables\|useencoding\|usesymbols\|stelle\a\+\|verwende\a\+\|stel\a\+\|gebruik\a\+\|usa\a\+\|imposta\a\+\|regle\a\+\|utilisemodule\>'
let kwline = search('^\s*\\\%(' . lpat . '\)\|^\s*\\\(' . cpat . '\)',
\ 'cnp', firstNC + 1000)
if kwline == 1 " lpat matched
let format = 'latex'
elseif kwline == 2 " cpat matched
let format = 'context'
endif " If neither matched, keep default set above.
" let lline = search('^\s*\\\%(' . lpat . '\)', 'cn', firstNC + 1000)
" let cline = search('^\s*\\\%(' . cpat . '\)', 'cn', firstNC + 1000)
" if cline > 0
" let format = 'context'
" endif
" if lline > 0 && (cline == 0 || cline > lline)
" let format = 'tex'
" endif
endif " firstNC
call setpos('.', save_cursor)
endif " firstline =~ '^%&\s*\a\+'
" Translation from formats to file types. TODO: add AMSTeX, RevTex, others?
if format == 'plain'
setf plaintex
elseif format == 'context'
setf context
else " probably LaTeX
setf tex
endif
return
endfun
" Context

View File

@ -1,7 +1,7 @@
" matchit.vim: (global plugin) Extended "%" matching
" Last Change: Sat May 15 11:00 AM 2004 EDT
" Last Change: Sun Feb 26 10:00 AM 2006 EST
" Maintainer: Benji Fisher PhD <benji@member.AMS.org>
" Version: 1.9, for Vim 6.3
" Version: 1.10, for Vim 6.3
" URL: http://www.vim.org/script.php?script_id=39
" Documentation:
@ -220,6 +220,10 @@ function! s:Match_wrapper(word, forward, mode) range
let ini = strpart(group, 0, i-1)
let mid = substitute(strpart(group, i,j-i-1), s:notslash.'\zs:', '\\|', 'g')
let fin = strpart(group, j)
"Un-escape the remaining , and : characters.
let ini = substitute(ini, s:notslash . '\zs\\\(:\|,\)', '\1', 'g')
let mid = substitute(mid, s:notslash . '\zs\\\(:\|,\)', '\1', 'g')
let fin = substitute(fin, s:notslash . '\zs\\\(:\|,\)', '\1', 'g')
" searchpair() requires that these patterns avoid \(\) groups.
let ini = substitute(ini, s:notslash . '\zs\\(', '\\%(', 'g')
let mid = substitute(mid, s:notslash . '\zs\\(', '\\%(', 'g')
@ -565,7 +569,7 @@ fun! s:Choose(patterns, string, comma, branch, prefix, suffix, ...)
if a:branch == ""
let currpat = current
else
let currpat = substitute(current, a:branch, '\\|', 'g')
let currpat = substitute(current, s:notslash . a:branch, '\\|', 'g')
endif
while a:string !~ a:prefix . currpat . a:suffix
let tail = strpart(tail, i)
@ -577,7 +581,7 @@ fun! s:Choose(patterns, string, comma, branch, prefix, suffix, ...)
if a:branch == ""
let currpat = current
else
let currpat = substitute(current, a:branch, '\\|', 'g')
let currpat = substitute(current, s:notslash . a:branch, '\\|', 'g')
endif
if a:0
let alttail = strpart(alttail, j)