# HG changeset patch # User vimboss # Date 1178822658 0 # Node ID aea597af5b4ec0d40d8968b3326ed0698d68a705 # Parent 2136af39a655e4df023d693942815221cd9c3941 updated for version 7.1b diff --git a/runtime/doc/spell.txt b/runtime/doc/spell.txt --- a/runtime/doc/spell.txt +++ b/runtime/doc/spell.txt @@ -1,4 +1,4 @@ -*spell.txt* For Vim version 7.1a. Last change: 2007 Apr 22 +*spell.txt* For Vim version 7.1b. Last change: 2007 May 07 VIM REFERENCE MANUAL by Bram Moolenaar @@ -624,7 +624,7 @@ ask you where to write the file. The plugin has a default place where to look for spell files, on the Vim ftp server. If you want to use another location or another protocol, set the g:spellfile_URL variable to the directory that holds the spell files. The -|netrw| plugin is used for getting the file, look there for the speficic +|netrw| plugin is used for getting the file, look there for the specific syntax of the URL. Example: > let g:spellfile_URL = 'http://ftp.vim.org/vim/runtime/spell' You may need to escape special characters. @@ -654,6 +654,9 @@ The default "spellfile.vim" plugin uses autocommand afterwards you may want to use ":au! SpellFileMissing" to overrule it. If you define your autocommand before the plugin is loaded it will notice this and not do anything. + *E797* +Note that the SpellFileMissing autocommand must not change or destroy the +buffer the user was editing. ============================================================================== 4. Spell file format *spell-file-format* diff --git a/runtime/doc/usr_01.txt b/runtime/doc/usr_01.txt --- a/runtime/doc/usr_01.txt +++ b/runtime/doc/usr_01.txt @@ -1,4 +1,4 @@ -*usr_01.txt* For Vim version 7.1a. Last change: 2006 Oct 08 +*usr_01.txt* For Vim version 7.1b. Last change: 2006 Oct 08 VIM USER MANUAL - by Bram Moolenaar diff --git a/runtime/doc/usr_27.txt b/runtime/doc/usr_27.txt --- a/runtime/doc/usr_27.txt +++ b/runtime/doc/usr_27.txt @@ -1,4 +1,4 @@ -*usr_27.txt* For Vim version 7.1a. Last change: 2006 Apr 24 +*usr_27.txt* For Vim version 7.1b. Last change: 2006 Apr 24 VIM USER MANUAL - by Bram Moolenaar diff --git a/runtime/filetype.vim b/runtime/filetype.vim --- a/runtime/filetype.vim +++ b/runtime/filetype.vim @@ -1,7 +1,7 @@ " Vim support file to detect file types " " Maintainer: Bram Moolenaar -" Last Change: 2007 Apr 26 +" Last Change: 2007 May 10 " Listen very carefully, I will say this only once if exists("did_load_filetypes") @@ -39,16 +39,16 @@ endif " Function used for patterns that end in a star: don't set the filetype if the " file name matches ft_ignore_pat. -fun! s:StarSetf(ft) +func! s:StarSetf(ft) if expand("") !~ g:ft_ignore_pat exe 'setf ' . a:ft endif -endfun +endfunc " Abaqus or Trasys au BufNewFile,BufRead *.inp call s:Check_inp() -fun! s:Check_inp() +func! s:Check_inp() if getline(1) =~ '^\*' setf abaqus else @@ -66,7 +66,7 @@ fun! s:Check_inp() let n = n + 1 endwhile endif -endfun +endfunc " A-A-P recipe au BufNewFile,BufRead *.aap setf aap @@ -159,7 +159,7 @@ au BufNewFile,BufRead *.asm,*.[sS],*.[aA " This function checks for the kind of assembly that is wanted by the user, or " can be detected from the first five lines of the file. -fun! s:FTasm() +func! s:FTasm() " make sure b:asmsyntax exists if !exists("b:asmsyntax") let b:asmsyntax = "" @@ -179,9 +179,9 @@ fun! s:FTasm() endif exe "setf " . b:asmsyntax -endfun - -fun! s:FTasmsyntax() +endfunc + +func! s:FTasmsyntax() " see if file contains any asmsyntax=foo overrides. If so, change " b:asmsyntax appropriately let head = " ".getline(1)." ".getline(2)." ".getline(3)." ".getline(4). @@ -191,7 +191,7 @@ fun! s:FTasmsyntax() elseif ((head =~? '\.title') || (head =~? '\.ident') || (head =~? '\.macro') || (head =~? '\.subtitle') || (head =~? '\.library')) let b:asmsyntax = "vmasm" endif -endfun +endfunc " Macro (VAX) au BufNewFile,BufRead *.mar setf vmasm @@ -202,6 +202,9 @@ au BufNewFile,BufRead *.atl,*.as setf a " Autoit v3 au BufNewFile,BufRead *.au3 setf autoit +" Autohotkey +au BufNewFile,BufRead *.ahk setf autohotkey + " Automake au BufNewFile,BufRead [mM]akefile.am,GNUmakefile.am setf automake @@ -222,13 +225,13 @@ au BufNewFile,BufRead *.bas call s:FTV " Check if one of the first five lines contains "VB_Name". In that case it is " probably a Visual Basic file. Otherwise it's assumed to be "alt" filetype. -fun! s:FTVB(alt) +func! s:FTVB(alt) if getline(1).getline(2).getline(3).getline(4).getline(5) =~? 'VB_Name\|Begin VB\.\(Form\|MDIForm\|UserControl\)' setf vb else exe "setf " . a:alt endif -endfun +endfunc " Visual Basic Script (close to Visual Basic) au BufNewFile,BufRead *.vbs,*.dsm,*.ctl setf vb @@ -247,13 +250,13 @@ au BufNewFile,BufRead *.cmd " Batch file for 4DOS au BufNewFile,BufRead *.btm call s:FTbtm() -fun! s:FTbtm() +func! s:FTbtm() if exists("g:dosbatch_syntax_for_btm") && g:dosbatch_syntax_for_btm setf dosbatch else setf btm endif -endfun +endfunc " BC calculator au BufNewFile,BufRead *.bc setf bc @@ -288,7 +291,7 @@ au BufNewFile,BufRead *.bl setf blank " C or lpc au BufNewFile,BufRead *.c call s:FTlpc() -fun! s:FTlpc() +func! s:FTlpc() if exists("g:lpc_syntax_for_c") let lnum = 1 while lnum <= 12 @@ -300,7 +303,7 @@ fun! s:FTlpc() endwhile endif setf c -endfun +endfunc " Calendar au BufNewFile,BufRead calendar setf calendar @@ -311,6 +314,9 @@ au BufNewFile,BufRead */.calendar/*, " C# au BufNewFile,BufRead *.cs setf cs +" Cdrdao TOC +au BufNewFile,BufRead *.toc setf cdrtoc + " Cfengine au BufNewFile,BufRead cfengine.conf setf cfengine @@ -386,7 +392,7 @@ au BufNewFile,BufRead *.ch call s:FTch " If the first line starts with # or ! it's probably a ch file. " If a line has "main", "include", "//" ir "/*" it's probably ch. " Otherwise CHILL is assumed. -fun! s:FTchange() +func! s:FTchange() let lnum = 1 while lnum <= 10 if getline(lnum)[0] == '@' @@ -408,7 +414,7 @@ fun! s:FTchange() let lnum = lnum + 1 endwhile setf chill -endfun +endfunc " ChordPro au BufNewFile,BufRead *.chopro,*.crd,*.cho,*.crdpro,*.chordpro setf chordpro @@ -422,7 +428,7 @@ au BufNewFile,BufRead *.eni setf cl " Clever or dtd au BufNewFile,BufRead *.ent call s:FTent() -fun! s:FTent() +func! s:FTent() " This function checks for valid cl syntax in the first five lines. " Look for either an opening comment, '#', or a block start, '{". " If not found, assume SGML. @@ -440,7 +446,7 @@ fun! s:FTent() let lnum = lnum + 1 endw setf dtd -endfun +endfunc " Clipper (or FoxPro; could also be eviews) au BufNewFile,BufRead *.prg @@ -576,7 +582,7 @@ au BufNewFile,BufRead *.e,*.E call s:F " Elinks configuration au BufNewFile,BufRead */etc/elinks.conf,*/.elinks/elinks.conf setf elinks -fun! s:FTe() +func! s:FTe() let n = 1 while n < 100 && n < line("$") if getline(n) =~ "^\\s*\\(<'\\|'>\\)\\s*$" @@ -586,7 +592,7 @@ fun! s:FTe() let n = n + 1 endwhile setf eiffel -endfun +endfunc " ERicsson LANGuage au BufNewFile,BufRead *.erl setf erlang @@ -705,7 +711,7 @@ au BufNewFile,BufRead *.t.html setf ti au BufNewFile,BufRead *.html,*.htm,*.shtml,*.stm call s:FThtml() " Distinguish between HTML, XHTML and Django -fun! s:FThtml() +func! s:FThtml() let n = 1 while n < 10 && n < line("$") if getline(n) =~ '\ 50 ? 50 : line("$") for n in range(1, max) @@ -1432,7 +1455,7 @@ fun! s:FTr() " Nothing recognized, assume Rexx setf rexx -endfun +endfunc " Remind au BufNewFile,BufRead .reminders* call s:StarSetf('remind') @@ -1461,8 +1484,11 @@ au BufNewFile,BufRead *.rtf setf rtf " Ruby au BufNewFile,BufRead *.rb,*.rbw,*.gem,*.gemspec setf ruby -" Rantfile is like Ruby -au BufNewFile,BufRead [rR]antfile,*.rant setf ruby +" Ruby on Rails +au BufNewFile,BufRead *.builder,*.rxml,*.rjs setf ruby + +" Rantfile and Rakefile is like Ruby +au BufNewFile,BufRead [rR]antfile,*.rant,[rR]akefile,*.rake setf ruby " S-lang (or shader language!) au BufNewFile,BufRead *.sl setf slang @@ -1540,7 +1566,7 @@ au BufNewFile,BufRead .kshrc*,*.ksh call au BufNewFile,BufRead /etc/profile,.profile*,*.sh,*.env call SetFileTypeSH(getline(1)) " Also called from scripts.vim. -fun! SetFileTypeSH(name) +func! SetFileTypeSH(name) if expand("") =~ g:ft_ignore_pat return endif @@ -1570,12 +1596,12 @@ fun! SetFileTypeSH(name) endif endif call SetFileTypeShell("sh") -endfun +endfunc " For shell-like file types, check for an "exec" command hidden in a comment, " as used for Tcl. " Also called from scripts.vim, thus can't be local to this script. -fun! SetFileTypeShell(name) +func! SetFileTypeShell(name) if expand("") =~ g:ft_ignore_pat return endif @@ -1593,7 +1619,7 @@ fun! SetFileTypeShell(name) endif endif exe "setf " . a:name -endfun +endfunc " tcsh scripts au BufNewFile,BufRead .tcshrc*,*.tcsh,tcsh.tcshrc,tcsh.login call SetFileTypeShell("tcsh") @@ -1601,7 +1627,7 @@ au BufNewFile,BufRead .tcshrc*,*.tcsh,tc " csh scripts, but might also be tcsh scripts (on some systems csh is tcsh) au BufNewFile,BufRead .login*,.cshrc*,csh.cshrc,csh.login,csh.logout,*.csh,.alias call s:CSH() -fun! s:CSH() +func! s:CSH() if exists("g:filetype_csh") call SetFileTypeShell(g:filetype_csh) elseif &shell =~ "tcsh" @@ -1609,7 +1635,7 @@ fun! s:CSH() else call SetFileTypeShell("csh") endif -endfun +endfunc " Z-Shell script au BufNewFile,BufRead .zprofile,/etc/zprofile,.zfbfmarks setf zsh @@ -1676,7 +1702,30 @@ au BufNewFile,BufRead *.sno,*.spt setf au BufNewFile,BufRead *.mib,*.my setf mib " Snort Configuration -au BufNewFile,BufRead *.hog,snort.conf,vision.conf,*.rules setf hog +au BufNewFile,BufRead *.hog,snort.conf,vision.conf setf hog +au BufNewFile,BufRead *.rules call s:FTRules() + +let s:ft_rules_udev_rules_pattern = '^\s*\cudev_rules\s*=\s*"\([^"]\{-1,}\)/*".*' +func! s:FTRules() + try + let config_lines = readfile('/etc/udev/udev.conf') + catch /^Vim\%((\a\+)\)\=:E484/ + setf hog + return + endtry + for line in config_lines + if line =~ s:ft_rules_udev_rules_pattern + let udev_rules = substitute(line, s:ft_rules_udev_rules_pattern, '\1', "") + let amatch_dirname = substitute(expand(''), '^\(.*\)/[^/]\+$', '\1', "") + if amatch_dirname == udev_rules + setf udevrules + endif + break + endif + endfor + setf hog +endfunc + " Spec (Linux RPM) au BufNewFile,BufRead *.spec setf spec @@ -1702,13 +1751,13 @@ au BufNewFile,BufRead *.tyb,*.typ,*.tyc, " SQL au BufNewFile,BufRead *.sql call s:SQL() -fun! s:SQL() +func! s:SQL() if exists("g:filetype_sql") exe "setf " . g:filetype_sql else setf sql endif -endfun +endfunc " SQLJ au BufNewFile,BufRead *.sqlj setf sqlj @@ -1746,7 +1795,7 @@ au BufNewFile,BufRead /etc/sudoers,sudoe " file. " (Slow test) If a file contains a 'use' statement then it is almost certainly " a Perl file. -fun! s:FTperl() +func! s:FTperl() if expand("%:e") == 't' && expand("%:p:h:t") == 't' setf perl return 1 @@ -1760,7 +1809,7 @@ fun! s:FTperl() return 1 endif return 0 -endfun +endfunc " Tads (or Nroff or Perl test file) au BufNewFile,BufRead *.t @@ -1792,7 +1841,7 @@ au BufNewFile,BufRead *.tex call s:FTt " 1. Check the first line of the file for "%&". " 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() +func! s:FTtex() let firstline = getline(1) if firstline =~ '^%&\s*\a\+' let format = tolower(matchstr(firstline, '\a\+')) @@ -1838,7 +1887,7 @@ fun! s:FTtex() setf tex endif return -endfun +endfunc " Context au BufNewFile,BufRead tex/context/*/*.tex setf context @@ -2036,7 +2085,7 @@ au BufNewFile,BufRead *.yy setf yacc " Yacc or racc au BufNewFile,BufRead *.y call s:FTy() -fun! s:FTy() +func! s:FTy() let n = 1 while n < 100 && n < line("$") let line = getline(n) @@ -2051,7 +2100,7 @@ fun! s:FTy() let n = n + 1 endwhile setf yacc -endfun +endfunc " Yaml @@ -2224,6 +2273,21 @@ if has("menu") && has("gui_running") source :p:h/menu.vim endif +" Function called for testing all functions defined here. These are +" script-local, thus need to be executed here. +" Returns a string with error messages (hopefully empty). +func! TestFiletypeFuncs(testlist) + let output = '' + for f in a:testlist + try + exe f + catch + let output = output . "\n" . f . ": " . v:exception + endtry + endfor + return output +endfunc + " Restore 'cpoptions' let &cpo = s:cpo_save unlet s:cpo_save diff --git a/src/edit.c b/src/edit.c --- a/src/edit.c +++ b/src/edit.c @@ -2055,7 +2055,7 @@ vim_is_ctrl_x_key(c) /* * This is like ins_compl_add(), but if 'ic' and 'inf' are set, then the * case of the originally typed text is used, and the case of the completed - * text is infered, ie this tries to work out what case you probably wanted + * text is inferred, ie this tries to work out what case you probably wanted * the rest of the word to be in -- webb * TODO: make this work for multi-byte characters. */ @@ -4309,7 +4309,7 @@ ins_compl_next(allow_get_expansion, coun } /* Enter will select a match when the match wasn't inserted and the popup - * menu is visislbe. */ + * menu is visible. */ compl_enter_selects = !insert_match && compl_match_array != NULL; /* @@ -7600,7 +7600,7 @@ ins_ctrl_g() ins_need_undo = TRUE; /* Need to reset Insstart, esp. because a BS that joins - * aline to the previous one must save for undo. */ + * a line to the previous one must save for undo. */ Insstart = curwin->w_cursor; break;