Mercurial > vim
annotate runtime/filetype.vim @ 4186:7ffc704cb7c1
Updated runtime files.
author | Bram Moolenaar <bram@vim.org> |
---|---|
date | Thu, 07 Mar 2013 13:20:54 +0100 |
parents | 8b86b69546a9 |
children | fa4089df54bc |
rev | line source |
---|---|
7 | 1 " Vim support file to detect file types |
2 " | |
3 " Maintainer: Bram Moolenaar <Bram@vim.org> | |
4186 | 4 " Last Change: 2013 Feb 28 |
7 | 5 |
6 " Listen very carefully, I will say this only once | |
7 if exists("did_load_filetypes") | |
8 finish | |
9 endif | |
10 let did_load_filetypes = 1 | |
11 | |
12 " Line continuation is used here, remove 'C' from 'cpoptions' | |
13 let s:cpo_save = &cpo | |
14 set cpo&vim | |
15 | |
16 augroup filetypedetect | |
17 | |
18 " Ignored extensions | |
1586 | 19 if exists("*fnameescape") |
3465 | 20 au BufNewFile,BufRead ?\+.orig,?\+.bak,?\+.old,?\+.new,?\+.dpkg-dist,?\+.dpkg-old,?\+.dpkg-new,?\+.dpkg-bak,?\+.rpmsave,?\+.rpmnew |
1586 | 21 \ exe "doau filetypedetect BufRead " . fnameescape(expand("<afile>:r")) |
7 | 22 au BufNewFile,BufRead *~ |
23 \ let s:name = expand("<afile>") | | |
24 \ let s:short = substitute(s:name, '\~$', '', '') | | |
25 \ if s:name != s:short && s:short != "" | | |
1586 | 26 \ exe "doau filetypedetect BufRead " . fnameescape(s:short) | |
7 | 27 \ endif | |
1698 | 28 \ unlet! s:name s:short |
532 | 29 au BufNewFile,BufRead ?\+.in |
7 | 30 \ if expand("<afile>:t") != "configure.in" | |
1586 | 31 \ exe "doau filetypedetect BufRead " . fnameescape(expand("<afile>:r")) | |
7 | 32 \ endif |
1586 | 33 elseif &verbose > 0 |
34 echomsg "Warning: some filetypes will not be recognized because this version of Vim does not have fnameescape()" | |
35 endif | |
7 | 36 |
37 " Pattern used to match file names which should not be inspected. | |
38 " Currently finds compressed files. | |
39 if !exists("g:ft_ignore_pat") | |
40 let g:ft_ignore_pat = '\.\(Z\|gz\|bz2\|zip\|tgz\)$' | |
41 endif | |
42 | |
216 | 43 " Function used for patterns that end in a star: don't set the filetype if the |
44 " file name matches ft_ignore_pat. | |
1219 | 45 func! s:StarSetf(ft) |
216 | 46 if expand("<amatch>") !~ g:ft_ignore_pat |
47 exe 'setf ' . a:ft | |
48 endif | |
1219 | 49 endfunc |
216 | 50 |
7 | 51 " Abaqus or Trasys |
216 | 52 au BufNewFile,BufRead *.inp call s:Check_inp() |
7 | 53 |
1219 | 54 func! s:Check_inp() |
7 | 55 if getline(1) =~ '^\*' |
56 setf abaqus | |
57 else | |
58 let n = 1 | |
59 if line("$") > 500 | |
60 let nmax = 500 | |
61 else | |
62 let nmax = line("$") | |
63 endif | |
64 while n <= nmax | |
65 if getline(n) =~? "^header surface data" | |
66 setf trasys | |
67 break | |
68 endif | |
69 let n = n + 1 | |
70 endwhile | |
71 endif | |
1219 | 72 endfunc |
7 | 73 |
74 " A-A-P recipe | |
75 au BufNewFile,BufRead *.aap setf aap | |
76 | |
389 | 77 " A2ps printing utility |
2751 | 78 au BufNewFile,BufRead */etc/a2ps.cfg,*/etc/a2ps/*.cfg,a2psrc,.a2psrc setf a2ps |
389 | 79 |
22 | 80 " ABAB/4 |
81 au BufNewFile,BufRead *.abap setf abap | |
82 | |
7 | 83 " ABC music notation |
84 au BufNewFile,BufRead *.abc setf abc | |
85 | |
86 " ABEL | |
87 au BufNewFile,BufRead *.abl setf abel | |
88 | |
89 " AceDB | |
90 au BufNewFile,BufRead *.wrm setf acedb | |
91 | |
92 " Ada (83, 9X, 95) | |
93 au BufNewFile,BufRead *.adb,*.ads,*.ada setf ada | |
1125 | 94 if has("vms") |
1676 | 95 au BufNewFile,BufRead *.gpr,*.ada_m,*.adc setf ada |
1125 | 96 else |
1676 | 97 au BufNewFile,BufRead *.gpr setf ada |
1125 | 98 endif |
7 | 99 |
100 " AHDL | |
101 au BufNewFile,BufRead *.tdf setf ahdl | |
102 | |
103 " AMPL | |
104 au BufNewFile,BufRead *.run setf ampl | |
105 | |
106 " Ant | |
107 au BufNewFile,BufRead build.xml setf ant | |
108 | |
109 " Apache style config file | |
216 | 110 au BufNewFile,BufRead proftpd.conf* call s:StarSetf('apachestyle') |
7 | 111 |
112 " Apache config file | |
2751 | 113 au BufNewFile,BufRead .htaccess,*/etc/httpd/*.conf setf apache |
7 | 114 |
115 " XA65 MOS6510 cross assembler | |
116 au BufNewFile,BufRead *.a65 setf a65 | |
117 | |
2034 | 118 " Applescript |
119 au BufNewFile,BufRead *.scpt setf applescript | |
120 | |
7 | 121 " Applix ELF |
122 au BufNewFile,BufRead *.am | |
123 \ if expand("<afile>") !~? 'Makefile.am\>' | setf elf | endif | |
124 | |
24 | 125 " ALSA configuration |
2788 | 126 au BufNewFile,BufRead .asoundrc,*/usr/share/alsa/alsa.conf,*/etc/asound.conf setf alsaconf |
24 | 127 |
7 | 128 " Arc Macro Language |
129 au BufNewFile,BufRead *.aml setf aml | |
130 | |
3854 | 131 " APT config file |
132 au BufNewFile,BufRead apt.conf setf aptconf | |
133 au BufNewFile,BufRead */.aptitude/config setf aptconf | |
134 au BufNewFile,BufRead */etc/apt/apt.conf.d/{[-_[:alnum:]]\+,[-_.[:alnum:]]\+.conf} setf aptconf | |
135 | |
7 | 136 " Arch Inventory file |
137 au BufNewFile,BufRead .arch-inventory,=tagging-method setf arch | |
138 | |
139 " ART*Enterprise (formerly ART-IM) | |
140 au BufNewFile,BufRead *.art setf art | |
141 | |
142 " ASN.1 | |
143 au BufNewFile,BufRead *.asn,*.asn1 setf asn | |
144 | |
145 " Active Server Pages (with Visual Basic Script) | |
146 au BufNewFile,BufRead *.asa | |
147 \ if exists("g:filetype_asa") | | |
148 \ exe "setf " . g:filetype_asa | | |
149 \ else | | |
150 \ setf aspvbs | | |
151 \ endif | |
152 | |
153 " Active Server Pages (with Perl or Visual Basic Script) | |
154 au BufNewFile,BufRead *.asp | |
155 \ if exists("g:filetype_asp") | | |
156 \ exe "setf " . g:filetype_asp | | |
157 \ elseif getline(1) . getline(2) . getline(3) =~? "perlscript" | | |
158 \ setf aspperl | | |
159 \ else | | |
160 \ setf aspvbs | | |
161 \ endif | |
162 | |
163 " Grub (must be before catch *.lst) | |
2788 | 164 au BufNewFile,BufRead */boot/grub/menu.lst,*/boot/grub/grub.conf,*/etc/grub.conf setf grub |
7 | 165 |
166 " Assembly (all kinds) | |
167 " *.lst is not pure assembly, it has two extra columns (address, byte codes) | |
216 | 168 au BufNewFile,BufRead *.asm,*.[sS],*.[aA],*.mac,*.lst call s:FTasm() |
7 | 169 |
170 " This function checks for the kind of assembly that is wanted by the user, or | |
171 " can be detected from the first five lines of the file. | |
1219 | 172 func! s:FTasm() |
7 | 173 " make sure b:asmsyntax exists |
174 if !exists("b:asmsyntax") | |
175 let b:asmsyntax = "" | |
176 endif | |
177 | |
178 if b:asmsyntax == "" | |
216 | 179 call s:FTasmsyntax() |
7 | 180 endif |
181 | |
182 " if b:asmsyntax still isn't set, default to asmsyntax or GNU | |
183 if b:asmsyntax == "" | |
184 if exists("g:asmsyntax") | |
185 let b:asmsyntax = g:asmsyntax | |
186 else | |
187 let b:asmsyntax = "asm" | |
188 endif | |
189 endif | |
190 | |
1698 | 191 exe "setf " . fnameescape(b:asmsyntax) |
1219 | 192 endfunc |
193 | |
194 func! s:FTasmsyntax() | |
7 | 195 " see if file contains any asmsyntax=foo overrides. If so, change |
196 " b:asmsyntax appropriately | |
197 let head = " ".getline(1)." ".getline(2)." ".getline(3)." ".getline(4). | |
198 \" ".getline(5)." " | |
1698 | 199 let match = matchstr(head, '\sasmsyntax=\zs[a-zA-Z0-9]\+\ze\s') |
200 if match != '' | |
201 let b:asmsyntax = match | |
7 | 202 elseif ((head =~? '\.title') || (head =~? '\.ident') || (head =~? '\.macro') || (head =~? '\.subtitle') || (head =~? '\.library')) |
203 let b:asmsyntax = "vmasm" | |
204 endif | |
1219 | 205 endfunc |
7 | 206 |
207 " Macro (VAX) | |
208 au BufNewFile,BufRead *.mar setf vmasm | |
209 | |
210 " Atlas | |
211 au BufNewFile,BufRead *.atl,*.as setf atlas | |
212 | |
1125 | 213 " Autoit v3 |
214 au BufNewFile,BufRead *.au3 setf autoit | |
215 | |
1219 | 216 " Autohotkey |
217 au BufNewFile,BufRead *.ahk setf autohotkey | |
218 | |
7 | 219 " Automake |
809 | 220 au BufNewFile,BufRead [mM]akefile.am,GNUmakefile.am setf automake |
7 | 221 |
375 | 222 " Autotest .at files are actually m4 |
223 au BufNewFile,BufRead *.at setf m4 | |
224 | |
7 | 225 " Avenue |
226 au BufNewFile,BufRead *.ave setf ave | |
227 | |
228 " Awk | |
229 au BufNewFile,BufRead *.awk setf awk | |
230 | |
231 " B | |
232 au BufNewFile,BufRead *.mch,*.ref,*.imp setf b | |
233 | |
234 " BASIC or Visual Basic | |
216 | 235 au BufNewFile,BufRead *.bas call s:FTVB("basic") |
7 | 236 |
237 " Check if one of the first five lines contains "VB_Name". In that case it is | |
238 " probably a Visual Basic file. Otherwise it's assumed to be "alt" filetype. | |
1219 | 239 func! s:FTVB(alt) |
7 | 240 if getline(1).getline(2).getline(3).getline(4).getline(5) =~? 'VB_Name\|Begin VB\.\(Form\|MDIForm\|UserControl\)' |
241 setf vb | |
242 else | |
243 exe "setf " . a:alt | |
244 endif | |
1219 | 245 endfunc |
7 | 246 |
3465 | 247 " Visual Basic Script (close to Visual Basic) or Visual Basic .NET |
248 au BufNewFile,BufRead *.vb,*.vbs,*.dsm,*.ctl setf vb | |
7 | 249 |
1125 | 250 " IBasic file (similar to QBasic) |
251 au BufNewFile,BufRead *.iba,*.ibi setf ibasic | |
252 | |
253 " FreeBasic file (similar to QBasic) | |
254 au BufNewFile,BufRead *.fb,*.bi setf freebasic | |
255 | |
7 | 256 " Batch file for MSDOS. |
15 | 257 au BufNewFile,BufRead *.bat,*.sys setf dosbatch |
7 | 258 " *.cmd is close to a Batch file, but on OS/2 Rexx files also use *.cmd. |
259 au BufNewFile,BufRead *.cmd | |
260 \ if getline(1) =~ '^/\*' | setf rexx | else | setf dosbatch | endif | |
261 | |
262 " Batch file for 4DOS | |
216 | 263 au BufNewFile,BufRead *.btm call s:FTbtm() |
1219 | 264 func! s:FTbtm() |
15 | 265 if exists("g:dosbatch_syntax_for_btm") && g:dosbatch_syntax_for_btm |
266 setf dosbatch | |
267 else | |
268 setf btm | |
269 endif | |
1219 | 270 endfunc |
7 | 271 |
272 " BC calculator | |
273 au BufNewFile,BufRead *.bc setf bc | |
274 | |
275 " BDF font | |
276 au BufNewFile,BufRead *.bdf setf bdf | |
277 | |
278 " BibTeX bibliography database file | |
279 au BufNewFile,BufRead *.bib setf bib | |
280 | |
846 | 281 " BibTeX Bibliography Style |
282 au BufNewFile,BufRead *.bst setf bst | |
283 | |
7 | 284 " BIND configuration |
45 | 285 au BufNewFile,BufRead named.conf,rndc.conf setf named |
7 | 286 |
287 " BIND zone | |
288 au BufNewFile,BufRead named.root setf bindzone | |
805 | 289 au BufNewFile,BufRead *.db call s:BindzoneCheck('') |
290 | |
291 func! s:BindzoneCheck(default) | |
292 if getline(1).getline(2).getline(3).getline(4) =~ '^; <<>> DiG [0-9.]\+ <<>>\|BIND.*named\|$ORIGIN\|$TTL\|IN\s\+SOA' | |
293 setf bindzone | |
294 elseif a:default != '' | |
295 exe 'setf ' . a:default | |
296 endif | |
297 endfunc | |
7 | 298 |
299 " Blank | |
300 au BufNewFile,BufRead *.bl setf blank | |
301 | |
1676 | 302 " Blkid cache file |
2751 | 303 au BufNewFile,BufRead */etc/blkid.tab,*/etc/blkid.tab.old setf xml |
1676 | 304 |
7 | 305 " C or lpc |
216 | 306 au BufNewFile,BufRead *.c call s:FTlpc() |
7 | 307 |
1219 | 308 func! s:FTlpc() |
7 | 309 if exists("g:lpc_syntax_for_c") |
310 let lnum = 1 | |
311 while lnum <= 12 | |
312 if getline(lnum) =~# '^\(//\|inherit\|private\|protected\|nosave\|string\|object\|mapping\|mixed\)' | |
313 setf lpc | |
314 return | |
315 endif | |
316 let lnum = lnum + 1 | |
317 endwhile | |
318 endif | |
319 setf c | |
1219 | 320 endfunc |
7 | 321 |
322 " Calendar | |
216 | 323 au BufNewFile,BufRead calendar setf calendar |
7 | 324 |
325 " C# | |
326 au BufNewFile,BufRead *.cs setf cs | |
327 | |
4186 | 328 " CSDL |
329 au BufNewFile,BufRead *.csdl setf csdl | |
330 | |
2152 | 331 " Cabal |
2725 | 332 au BufNewFile,BufRead *.cabal setf cabal |
2152 | 333 |
1219 | 334 " Cdrdao TOC |
335 au BufNewFile,BufRead *.toc setf cdrtoc | |
336 | |
1648 | 337 " Cdrdao config |
2788 | 338 au BufNewFile,BufRead */etc/cdrdao.conf,*/etc/defaults/cdrdao,*/etc/default/cdrdao,.cdrdao setf cdrdaoconf |
1648 | 339 |
555 | 340 " Cfengine |
341 au BufNewFile,BufRead cfengine.conf setf cfengine | |
342 | |
2152 | 343 " ChaiScript |
344 au BufRead,BufNewFile *.chai setf chaiscript | |
345 | |
7 | 346 " Comshare Dimension Definition Language |
347 au BufNewFile,BufRead *.cdl setf cdl | |
348 | |
1125 | 349 " Conary Recipe |
350 au BufNewFile,BufRead *.recipe setf conaryrecipe | |
351 | |
7 | 352 " Controllable Regex Mutilator |
353 au BufNewFile,BufRead *.crm setf crm | |
354 | |
355 " Cyn++ | |
356 au BufNewFile,BufRead *.cyn setf cynpp | |
357 | |
358 " Cynlib | |
359 " .cc and .cpp files can be C++ or Cynlib. | |
360 au BufNewFile,BufRead *.cc | |
361 \ if exists("cynlib_syntax_for_cc")|setf cynlib|else|setf cpp|endif | |
362 au BufNewFile,BufRead *.cpp | |
363 \ if exists("cynlib_syntax_for_cpp")|setf cynlib|else|setf cpp|endif | |
364 | |
365 " C++ | |
2034 | 366 au BufNewFile,BufRead *.cxx,*.c++,*.hh,*.hxx,*.hpp,*.ipp,*.moc,*.tcc,*.inl setf cpp |
7 | 367 if has("fname_case") |
2034 | 368 au BufNewFile,BufRead *.C,*.H setf cpp |
7 | 369 endif |
370 | |
1648 | 371 " .h files can be C, Ch C++, ObjC or ObjC++. |
372 " Set c_syntax_for_h if you want C, ch_syntax_for_h if you want Ch. ObjC is | |
373 " detected automatically. | |
374 au BufNewFile,BufRead *.h call s:FTheader() | |
375 | |
376 func! s:FTheader() | |
377 if match(getline(1, min([line("$"), 200])), '^@\(interface\|end\|class\)') > -1 | |
3445 | 378 if exists("g:c_syntax_for_h") |
379 setf objc | |
380 else | |
381 setf objcpp | |
382 endif | |
2034 | 383 elseif exists("g:c_syntax_for_h") |
1648 | 384 setf c |
2034 | 385 elseif exists("g:ch_syntax_for_h") |
1648 | 386 setf ch |
387 else | |
388 setf cpp | |
389 endif | |
390 endfunc | |
7 | 391 |
392 " Ch (CHscript) | |
393 au BufNewFile,BufRead *.chf setf ch | |
394 | |
395 " TLH files are C++ headers generated by Visual C++'s #import from typelibs | |
396 au BufNewFile,BufRead *.tlh setf cpp | |
397 | |
398 " Cascading Style Sheets | |
399 au BufNewFile,BufRead *.css setf css | |
400 | |
401 " Century Term Command Scripts (*.cmd too) | |
402 au BufNewFile,BufRead *.con setf cterm | |
403 | |
404 " Changelog | |
809 | 405 au BufNewFile,BufRead changelog.Debian,changelog.dch,NEWS.Debian,NEWS.dch |
406 \ setf debchangelog | |
407 | |
408 au BufNewFile,BufRead [cC]hange[lL]og | |
409 \ if getline(1) =~ '; urgency=' | |
410 \| setf debchangelog | |
411 \| else | |
412 \| setf changelog | |
413 \| endif | |
414 | |
415 au BufNewFile,BufRead NEWS | |
416 \ if getline(1) =~ '; urgency=' | |
417 \| setf debchangelog | |
418 \| endif | |
7 | 419 |
420 " CHILL | |
421 au BufNewFile,BufRead *..ch setf chill | |
422 | |
423 " Changes for WEB and CWEB or CHILL | |
216 | 424 au BufNewFile,BufRead *.ch call s:FTchange() |
7 | 425 |
426 " This function checks if one of the first ten lines start with a '@'. In | |
427 " that case it is probably a change file. | |
428 " If the first line starts with # or ! it's probably a ch file. | |
429 " If a line has "main", "include", "//" ir "/*" it's probably ch. | |
430 " Otherwise CHILL is assumed. | |
1219 | 431 func! s:FTchange() |
7 | 432 let lnum = 1 |
433 while lnum <= 10 | |
434 if getline(lnum)[0] == '@' | |
435 setf change | |
436 return | |
437 endif | |
438 if lnum == 1 && (getline(1)[0] == '#' || getline(1)[0] == '!') | |
439 setf ch | |
440 return | |
441 endif | |
442 if getline(lnum) =~ "MODULE" | |
443 setf chill | |
444 return | |
445 endif | |
446 if getline(lnum) =~ 'main\s*(\|#\s*include\|//' | |
447 setf ch | |
448 return | |
449 endif | |
450 let lnum = lnum + 1 | |
451 endwhile | |
452 setf chill | |
1219 | 453 endfunc |
7 | 454 |
839 | 455 " ChordPro |
456 au BufNewFile,BufRead *.chopro,*.crd,*.cho,*.crdpro,*.chordpro setf chordpro | |
457 | |
7 | 458 " Clean |
459 au BufNewFile,BufRead *.dcl,*.icl setf clean | |
460 | |
461 " Clever | |
462 au BufNewFile,BufRead *.eni setf cl | |
463 | |
464 " Clever or dtd | |
216 | 465 au BufNewFile,BufRead *.ent call s:FTent() |
7 | 466 |
1219 | 467 func! s:FTent() |
7 | 468 " This function checks for valid cl syntax in the first five lines. |
469 " Look for either an opening comment, '#', or a block start, '{". | |
470 " If not found, assume SGML. | |
471 let lnum = 1 | |
472 while lnum < 6 | |
473 let line = getline(lnum) | |
474 if line =~ '^\s*[#{]' | |
475 setf cl | |
476 return | |
477 elseif line !~ '^\s*$' | |
478 " Not a blank line, not a comment, and not a block start, | |
479 " so doesn't look like valid cl code. | |
480 break | |
481 endif | |
482 let lnum = lnum + 1 | |
483 endw | |
484 setf dtd | |
1219 | 485 endfunc |
7 | 486 |
625 | 487 " Clipper (or FoxPro; could also be eviews) |
7 | 488 au BufNewFile,BufRead *.prg |
489 \ if exists("g:filetype_prg") | | |
490 \ exe "setf " . g:filetype_prg | | |
491 \ else | | |
492 \ setf clipper | | |
493 \ endif | |
494 | |
4098 | 495 " Clojure |
496 au BufNewFile,BufRead *.clj,*.cljs setf clojure | |
497 | |
836 | 498 " Cmake |
499 au BufNewFile,BufRead CMakeLists.txt,*.cmake,*.cmake.in setf cmake | |
500 | |
1125 | 501 " Cmusrc |
2788 | 502 au BufNewFile,BufRead */.cmus/{autosave,rc,command-history,*.theme} setf cmusrc |
1125 | 503 au BufNewFile,BufRead */cmus/{rc,*.theme} setf cmusrc |
504 | |
7 | 505 " Cobol |
809 | 506 au BufNewFile,BufRead *.cbl,*.cob,*.lib setf cobol |
507 " cobol or zope form controller python script? (heuristic) | |
508 au BufNewFile,BufRead *.cpy | |
509 \ if getline(1) =~ '^##' | | |
510 \ setf python | | |
511 \ else | | |
512 \ setf cobol | | |
513 \ endif | |
7 | 514 |
1648 | 515 " Coco/R |
516 au BufNewFile,BufRead *.atg setf coco | |
517 | |
7 | 518 " Cold Fusion |
519 au BufNewFile,BufRead *.cfm,*.cfi,*.cfc setf cf | |
520 | |
521 " Configure scripts | |
522 au BufNewFile,BufRead configure.in,configure.ac setf config | |
523 | |
1648 | 524 " CUDA Cumpute Unified Device Architecture |
525 au BufNewFile,BufRead *.cu setf cuda | |
526 | |
7 | 527 " WildPackets EtherPeek Decoder |
528 au BufNewFile,BufRead *.dcd setf dcd | |
529 | |
530 " Enlightenment configuration files | |
531 au BufNewFile,BufRead *enlightenment/*.cfg setf c | |
532 | |
533 " Eterm | |
534 au BufNewFile,BufRead *Eterm/*.cfg setf eterm | |
535 | |
536 " Lynx config files | |
537 au BufNewFile,BufRead lynx.cfg setf lynx | |
538 | |
539 " Quake | |
540 au BufNewFile,BufRead *baseq[2-3]/*.cfg,*id1/*.cfg setf quake | |
541 au BufNewFile,BufRead *quake[1-3]/*.cfg setf quake | |
542 | |
543 " Quake C | |
544 au BufNewFile,BufRead *.qc setf c | |
545 | |
546 " Configure files | |
547 au BufNewFile,BufRead *.cfg setf cfg | |
548 | |
2098
3259c3923c1e
Updated runtime an documentation files.
Bram Moolenaar <bram@zimbu.org>
parents:
2034
diff
changeset
|
549 " Cucumber |
2725 | 550 au BufNewFile,BufRead *.feature setf cucumber |
2098
3259c3923c1e
Updated runtime an documentation files.
Bram Moolenaar <bram@zimbu.org>
parents:
2034
diff
changeset
|
551 |
7 | 552 " Communicating Sequential Processes |
553 au BufNewFile,BufRead *.csp,*.fdr setf csp | |
554 | |
555 " CUPL logic description and simulation | |
556 au BufNewFile,BufRead *.pld setf cupl | |
557 au BufNewFile,BufRead *.si setf cuplsim | |
558 | |
559 " Debian Control | |
560 au BufNewFile,BufRead */debian/control setf debcontrol | |
1648 | 561 au BufNewFile,BufRead control |
562 \ if getline(1) =~ '^Source:' | |
563 \| setf debcontrol | |
564 \| endif | |
7 | 565 |
816 | 566 " Debian Sources.list |
2751 | 567 au BufNewFile,BufRead */etc/apt/sources.list setf debsources |
568 au BufNewFile,BufRead */etc/apt/sources.list.d/*.list setf debsources | |
816 | 569 |
1648 | 570 " Deny hosts |
571 au BufNewFile,BufRead denyhosts.conf setf denyhosts | |
572 | |
2788 | 573 " dnsmasq(8) configuration files |
2833 | 574 au BufNewFile,BufRead */etc/dnsmasq.conf setf dnsmasq |
2788 | 575 |
7 | 576 " ROCKLinux package description |
577 au BufNewFile,BufRead *.desc setf desc | |
578 | |
1648 | 579 " the D language or dtrace |
580 au BufNewFile,BufRead *.d call s:DtraceCheck() | |
581 | |
582 func! s:DtraceCheck() | |
583 let lines = getline(1, min([line("$"), 100])) | |
3224 | 584 if match(lines, '^module\>\|^import\>') > -1 |
585 " D files often start with a module and/or import statement. | |
586 setf d | |
587 elseif match(lines, '^#!\S\+dtrace\|#pragma\s\+D\s\+option\|:\S\{-}:\S\{-}:') > -1 | |
1648 | 588 setf dtrace |
589 else | |
590 setf d | |
591 endif | |
592 endfunc | |
7 | 593 |
594 " Desktop files | |
595 au BufNewFile,BufRead *.desktop,.directory setf desktop | |
596 | |
389 | 597 " Dict config |
598 au BufNewFile,BufRead dict.conf,.dictrc setf dictconf | |
599 | |
600 " Dictd config | |
601 au BufNewFile,BufRead dictd.conf setf dictdconf | |
602 | |
7 | 603 " Diff files |
604 au BufNewFile,BufRead *.diff,*.rej,*.patch setf diff | |
605 | |
606 " Dircolors | |
2751 | 607 au BufNewFile,BufRead .dir_colors,.dircolors,*/etc/DIR_COLORS setf dircolors |
7 | 608 |
609 " Diva (with Skill) or InstallShield | |
610 au BufNewFile,BufRead *.rul | |
611 \ if getline(1).getline(2).getline(3).getline(4).getline(5).getline(6) =~? 'InstallShield' | | |
612 \ setf ishd | | |
613 \ else | | |
614 \ setf diva | | |
615 \ endif | |
616 | |
617 " DCL (Digital Command Language - vms) or DNS zone file | |
805 | 618 au BufNewFile,BufRead *.com call s:BindzoneCheck('dcl') |
7 | 619 |
620 " DOT | |
621 au BufNewFile,BufRead *.dot setf dot | |
622 | |
623 " Dylan - lid files | |
624 au BufNewFile,BufRead *.lid setf dylanlid | |
625 | |
626 " Dylan - intr files (melange) | |
627 au BufNewFile,BufRead *.intr setf dylanintr | |
628 | |
629 " Dylan | |
630 au BufNewFile,BufRead *.dylan setf dylan | |
631 | |
632 " Microsoft Module Definition | |
633 au BufNewFile,BufRead *.def setf def | |
634 | |
635 " Dracula | |
636 au BufNewFile,BufRead *.drac,*.drc,*lvs,*lpe setf dracula | |
637 | |
2467
9c8d603fd4d1
Add Datascript syntax file. (Dominique Pelle)
Bram Moolenaar <bram@vim.org>
parents:
2439
diff
changeset
|
638 " Datascript |
9c8d603fd4d1
Add Datascript syntax file. (Dominique Pelle)
Bram Moolenaar <bram@vim.org>
parents:
2439
diff
changeset
|
639 au BufNewFile,BufRead *.ds setf datascript |
9c8d603fd4d1
Add Datascript syntax file. (Dominique Pelle)
Bram Moolenaar <bram@vim.org>
parents:
2439
diff
changeset
|
640 |
7 | 641 " dsl |
642 au BufNewFile,BufRead *.dsl setf dsl | |
643 | |
644 " DTD (Document Type Definition for XML) | |
645 au BufNewFile,BufRead *.dtd setf dtd | |
646 | |
3847 | 647 " DTS/DSTI (device tree files) |
648 au BufNewFile,BufRead *.dts,*.dtsi setf dts | |
649 | |
7 | 650 " EDIF (*.edf,*.edif,*.edn,*.edo) |
651 au BufNewFile,BufRead *.ed\(f\|if\|n\|o\) setf edif | |
652 | |
653 " Embedix Component Description | |
654 au BufNewFile,BufRead *.ecd setf ecd | |
655 | |
656 " Eiffel or Specman | |
216 | 657 au BufNewFile,BufRead *.e,*.E call s:FTe() |
7 | 658 |
659 " Elinks configuration | |
660 au BufNewFile,BufRead */etc/elinks.conf,*/.elinks/elinks.conf setf elinks | |
661 | |
1219 | 662 func! s:FTe() |
7 | 663 let n = 1 |
664 while n < 100 && n < line("$") | |
665 if getline(n) =~ "^\\s*\\(<'\\|'>\\)\\s*$" | |
666 setf specman | |
667 return | |
668 endif | |
669 let n = n + 1 | |
670 endwhile | |
671 setf eiffel | |
1219 | 672 endfunc |
7 | 673 |
1648 | 674 " ERicsson LANGuage; Yaws is erlang too |
1668 | 675 au BufNewFile,BufRead *.erl,*.hrl,*.yaws setf erlang |
7 | 676 |
677 " Elm Filter Rules file | |
678 au BufNewFile,BufRead filter-rules setf elmfilt | |
679 | |
168 | 680 " ESMTP rc file |
681 au BufNewFile,BufRead *esmtprc setf esmtprc | |
682 | |
7 | 683 " ESQL-C |
684 au BufNewFile,BufRead *.ec,*.EC setf esqlc | |
685 | |
278 | 686 " Esterel |
687 au BufNewFile,BufRead *.strl setf esterel | |
688 | |
7 | 689 " Essbase script |
690 au BufNewFile,BufRead *.csc setf csc | |
691 | |
692 " Exim | |
693 au BufNewFile,BufRead exim.conf setf exim | |
694 | |
695 " Expect | |
696 au BufNewFile,BufRead *.exp setf expect | |
697 | |
698 " Exports | |
699 au BufNewFile,BufRead exports setf exports | |
700 | |
2596 | 701 " Falcon |
2725 | 702 au BufNewFile,BufRead *.fal setf falcon |
2596 | 703 |
2243
03a5f2897db3
Fix completion of file names with '%' and '*'.
Bram Moolenaar <bram@vim.org>
parents:
2202
diff
changeset
|
704 " Fantom |
03a5f2897db3
Fix completion of file names with '%' and '*'.
Bram Moolenaar <bram@vim.org>
parents:
2202
diff
changeset
|
705 au BufNewFile,BufRead *.fan,*.fwt setf fan |
03a5f2897db3
Fix completion of file names with '%' and '*'.
Bram Moolenaar <bram@vim.org>
parents:
2202
diff
changeset
|
706 |
333 | 707 " Factor |
708 au BufNewFile,BufRead *.factor setf factor | |
709 | |
7 | 710 " Fetchmail RC file |
711 au BufNewFile,BufRead .fetchmailrc setf fetchmail | |
712 | |
2034 | 713 " FlexWiki - disabled, because it has side effects when a .wiki file |
714 " is not actually FlexWiki | |
715 "au BufNewFile,BufRead *.wiki setf flexwiki | |
846 | 716 |
7 | 717 " Focus Executable |
718 au BufNewFile,BufRead *.fex,*.focexec setf focexec | |
719 | |
720 " Focus Master file (but not for auto.master) | |
721 au BufNewFile,BufRead auto.master setf conf | |
722 au BufNewFile,BufRead *.mas,*.master setf master | |
723 | |
724 " Forth | |
725 au BufNewFile,BufRead *.fs,*.ft setf forth | |
726 | |
1648 | 727 " Reva Forth |
728 au BufNewFile,BufRead *.frt setf reva | |
729 | |
7 | 730 " Fortran |
1125 | 731 if has("fname_case") |
2478
11def19fbb0e
Recognize .f03 and .f08 as Fortran files. (Ajit Thakkar)
Bram Moolenaar <bram@vim.org>
parents:
2467
diff
changeset
|
732 au BufNewFile,BufRead *.F,*.FOR,*.FPP,*.FTN,*.F77,*.F90,*.F95,*.F03,*.F08 setf fortran |
1125 | 733 endif |
2478
11def19fbb0e
Recognize .f03 and .f08 as Fortran files. (Ajit Thakkar)
Bram Moolenaar <bram@vim.org>
parents:
2467
diff
changeset
|
734 au BufNewFile,BufRead *.f,*.for,*.fortran,*.fpp,*.ftn,*.f77,*.f90,*.f95,*.f03,*.f08 setf fortran |
7 | 735 |
1698 | 736 " Framescript |
737 au BufNewFile,BufRead *.fsl setf framescript | |
738 | |
7 | 739 " FStab |
819 | 740 au BufNewFile,BufRead fstab,mtab setf fstab |
7 | 741 |
742 " GDB command files | |
743 au BufNewFile,BufRead .gdbinit setf gdb | |
744 | |
745 " GDMO | |
746 au BufNewFile,BufRead *.mo,*.gdmo setf gdmo | |
747 | |
748 " Gedcom | |
2034 | 749 au BufNewFile,BufRead *.ged,lltxxxxx.txt setf gedcom |
7 | 750 |
1648 | 751 " Git |
3465 | 752 au BufNewFile,BufRead *.git/COMMIT_EDITMSG setf gitcommit |
4098 | 753 au BufNewFile,BufRead *.git/MERGE_MSG setf gitcommit |
2788 | 754 au BufNewFile,BufRead *.git/config,.gitconfig,.gitmodules setf gitconfig |
3465 | 755 au BufNewFile,BufRead *.git/modules/**/COMMIT_EDITMSG setf gitcommit |
756 au BufNewFile,BufRead *.git/modules/**/config setf gitconfig | |
757 au BufNewFile,BufRead git-rebase-todo setf gitrebase | |
2788 | 758 au BufNewFile,BufRead .msg.[0-9]* |
1648 | 759 \ if getline(1) =~ '^From.*# This line is ignored.$' | |
760 \ setf gitsendemail | | |
761 \ endif | |
2788 | 762 au BufNewFile,BufRead *.git/** |
1648 | 763 \ if getline(1) =~ '^\x\{40\}\>\|^ref: ' | |
764 \ setf git | | |
765 \ endif | |
766 | |
7 | 767 " Gkrellmrc |
768 au BufNewFile,BufRead gkrellmrc,gkrellmrc_? setf gkrellmrc | |
769 | |
770 " GP scripts (2.0 and onward) | |
827 | 771 au BufNewFile,BufRead *.gp,.gprc setf gp |
7 | 772 |
773 " GPG | |
774 au BufNewFile,BufRead */.gnupg/options setf gpg | |
775 au BufNewFile,BufRead */.gnupg/gpg.conf setf gpg | |
2788 | 776 au BufNewFile,BufRead */usr/**/gnupg/options.skel setf gpg |
777 | |
778 " gnash(1) configuration files | |
779 au BufNewFile,BufRead gnashrc,.gnashrc,gnashpluginrc,.gnashpluginrc setf gnash | |
7 | 780 |
3153 | 781 " Gitolite |
782 au BufNewFile,BufRead gitolite.conf setf gitolite | |
783 au BufNewFile,BufRead */gitolite-admin/conf/* call s:StarSetf('gitolite') | |
784 au BufNewFile,BufRead {,.}gitolite.rc,example.gitolite.rc setf perl | |
785 | |
7 | 786 " Gnuplot scripts |
787 au BufNewFile,BufRead *.gpi setf gnuplot | |
788 | |
789 " GrADS scripts | |
790 au BufNewFile,BufRead *.gs setf grads | |
791 | |
625 | 792 " Gretl |
793 au BufNewFile,BufRead *.gretl setf gretl | |
794 | |
7 | 795 " Groovy |
796 au BufNewFile,BufRead *.groovy setf groovy | |
797 | |
798 " GNU Server Pages | |
799 au BufNewFile,BufRead *.gsp setf gsp | |
800 | |
389 | 801 " Group file |
2751 | 802 au BufNewFile,BufRead */etc/group,*/etc/group-,*/etc/group.edit,*/etc/gshadow,*/etc/gshadow-,*/etc/gshadow.edit,*/var/backups/group.bak,*/var/backups/gshadow.bak setf group |
389 | 803 |
7 | 804 " GTK RC |
805 au BufNewFile,BufRead .gtkrc,gtkrc setf gtkrc | |
806 | |
1668 | 807 " Haml |
808 au BufNewFile,BufRead *.haml setf haml | |
809 | |
1125 | 810 " Hamster Classic | Playground files |
811 au BufNewFile,BufRead *.hsc,*.hsm setf hamster | |
812 | |
7 | 813 " Haskell |
2725 | 814 au BufNewFile,BufRead *.hs,*.hs-boot setf haskell |
7 | 815 au BufNewFile,BufRead *.lhs setf lhaskell |
816 au BufNewFile,BufRead *.chs setf chaskell | |
817 | |
1648 | 818 " Haste |
819 au BufNewFile,BufRead *.ht setf haste | |
1668 | 820 au BufNewFile,BufRead *.htpp setf hastepreproc |
1648 | 821 |
7 | 822 " Hercules |
823 au BufNewFile,BufRead *.vc,*.ev,*.rs,*.sum,*.errsum setf hercules | |
824 | |
825 " HEX (Intel) | |
826 au BufNewFile,BufRead *.hex,*.h32 setf hex | |
827 | |
828 " Tilde (must be before HTML) | |
829 au BufNewFile,BufRead *.t.html setf tilde | |
830 | |
497 | 831 " HTML (.shtml and .stm for server side) |
832 au BufNewFile,BufRead *.html,*.htm,*.shtml,*.stm call s:FThtml() | |
7 | 833 |
798 | 834 " Distinguish between HTML, XHTML and Django |
1219 | 835 func! s:FThtml() |
7 | 836 let n = 1 |
837 while n < 10 && n < line("$") | |
838 if getline(n) =~ '\<DTD\s\+XHTML\s' | |
839 setf xhtml | |
840 return | |
841 endif | |
798 | 842 if getline(n) =~ '{%\s*\(extends\|block\)\>' |
843 setf htmldjango | |
844 return | |
845 endif | |
7 | 846 let n = n + 1 |
847 endwhile | |
848 setf html | |
1219 | 849 endfunc |
7 | 850 |
497 | 851 " HTML with Ruby - eRuby |
1219 | 852 au BufNewFile,BufRead *.erb,*.rhtml setf eruby |
7 | 853 |
854 " HTML with M4 | |
855 au BufNewFile,BufRead *.html.m4 setf htmlm4 | |
856 | |
857 " HTML Cheetah template | |
858 au BufNewFile,BufRead *.tmpl setf htmlcheetah | |
859 | |
1648 | 860 " Host config |
2751 | 861 au BufNewFile,BufRead */etc/host.conf setf hostconf |
1648 | 862 |
1676 | 863 " Hosts access |
2751 | 864 au BufNewFile,BufRead */etc/hosts.allow,*/etc/hosts.deny setf hostsaccess |
1676 | 865 |
7 | 866 " Hyper Builder |
867 au BufNewFile,BufRead *.hb setf hb | |
868 | |
869 " Icon | |
870 au BufNewFile,BufRead *.icn setf icon | |
871 | |
872 " IDL (Interface Description Language) | |
216 | 873 au BufNewFile,BufRead *.idl call s:FTidl() |
7 | 874 |
875 " Distinguish between standard IDL and MS-IDL | |
1219 | 876 func! s:FTidl() |
7 | 877 let n = 1 |
878 while n < 50 && n < line("$") | |
879 if getline(n) =~ '^\s*import\s\+"\(unknwn\|objidl\)\.idl"' | |
880 setf msidl | |
881 return | |
882 endif | |
883 let n = n + 1 | |
884 endwhile | |
885 setf idl | |
1219 | 886 endfunc |
7 | 887 |
888 " Microsoft IDL (Interface Description Language) Also *.idl | |
889 " MOF = WMI (Windows Management Instrumentation) Managed Object Format | |
890 au BufNewFile,BufRead *.odl,*.mof setf msidl | |
891 | |
892 " Icewm menu | |
893 au BufNewFile,BufRead */.icewm/menu setf icemenu | |
894 | |
1219 | 895 " Indent profile (must come before IDL *.pro!) |
896 au BufNewFile,BufRead .indent.pro setf indent | |
897 au BufNewFile,BufRead indent.pro call s:ProtoCheck('indent') | |
898 | |
7 | 899 " IDL (Interactive Data Language) |
1219 | 900 au BufNewFile,BufRead *.pro call s:ProtoCheck('idlang') |
901 | |
902 " Distinguish between "default" and Cproto prototype file. */ | |
903 func! s:ProtoCheck(default) | |
904 " Cproto files have a comment in the first line and a function prototype in | |
905 " the second line, it always ends in ";". Indent files may also have | |
906 " comments, thus we can't match comments to see the difference. | |
2725 | 907 " IDL files can have a single ';' in the second line, require at least one |
908 " chacter before the ';'. | |
909 if getline(2) =~ '.;$' | |
1219 | 910 setf cpp |
911 else | |
912 exe 'setf ' . a:default | |
913 endif | |
914 endfunc | |
915 | |
7 | 916 |
389 | 917 " Indent RC |
1676 | 918 au BufNewFile,BufRead indentrc setf indent |
389 | 919 |
7 | 920 " Inform |
921 au BufNewFile,BufRead *.inf,*.INF setf inform | |
922 | |
1125 | 923 " Initng |
2751 | 924 au BufNewFile,BufRead */etc/initng/**/*.i,*.ii setf initng |
1125 | 925 |
148 | 926 " Ipfilter |
1125 | 927 au BufNewFile,BufRead ipf.conf,ipf6.conf,ipf.rules setf ipfilter |
148 | 928 |
7 | 929 " Informix 4GL (source - canonical, include file, I4GL+M4 preproc.) |
930 au BufNewFile,BufRead *.4gl,*.4gh,*.m4gl setf fgl | |
931 | |
932 " .INI file for MSDOS | |
933 au BufNewFile,BufRead *.ini setf dosini | |
934 | |
935 " SysV Inittab | |
936 au BufNewFile,BufRead inittab setf inittab | |
937 | |
938 " Inno Setup | |
939 au BufNewFile,BufRead *.iss setf iss | |
940 | |
941 " JAL | |
942 au BufNewFile,BufRead *.jal,*.JAL setf jal | |
943 | |
944 " Jam | |
945 au BufNewFile,BufRead *.jpl,*.jpr setf jam | |
946 | |
947 " Java | |
948 au BufNewFile,BufRead *.java,*.jav setf java | |
949 | |
950 " JavaCC | |
951 au BufNewFile,BufRead *.jj,*.jjt setf javacc | |
952 | |
1125 | 953 " JavaScript, ECMAScript |
3082 | 954 au BufNewFile,BufRead *.js,*.javascript,*.es,*.jsx,*.json setf javascript |
7 | 955 |
956 " Java Server Pages | |
957 au BufNewFile,BufRead *.jsp setf jsp | |
958 | |
959 " Java Properties resource file (note: doesn't catch font.properties.pl) | |
216 | 960 au BufNewFile,BufRead *.properties,*.properties_??,*.properties_??_?? setf jproperties |
961 au BufNewFile,BufRead *.properties_??_??_* call s:StarSetf('jproperties') | |
7 | 962 |
963 " Jess | |
964 au BufNewFile,BufRead *.clp setf jess | |
965 | |
966 " Jgraph | |
967 au BufNewFile,BufRead *.jgr setf jgraph | |
968 | |
2908 | 969 " Jovial |
970 au BufNewFile,BufRead *.jov,*.j73,*.jovial setf jovial | |
971 | |
7 | 972 " Kixtart |
973 au BufNewFile,BufRead *.kix setf kix | |
974 | |
975 " Kimwitu[++] | |
976 au BufNewFile,BufRead *.k setf kwt | |
977 | |
978 " KDE script | |
979 au BufNewFile,BufRead *.ks setf kscript | |
980 | |
826 | 981 " Kconfig |
982 au BufNewFile,BufRead Kconfig,Kconfig.debug setf kconfig | |
983 | |
7 | 984 " Lace (ISE) |
985 au BufNewFile,BufRead *.ace,*.ACE setf lace | |
986 | |
987 " Latte | |
988 au BufNewFile,BufRead *.latte,*.lte setf latte | |
989 | |
375 | 990 " Limits |
2751 | 991 au BufNewFile,BufRead */etc/limits,*/etc/*limits.conf,*/etc/*limits.d/*.conf setf limits |
375 | 992 |
7 | 993 " LambdaProlog (*.mod too, see Modsim) |
994 au BufNewFile,BufRead *.sig setf lprolog | |
995 | |
996 " LDAP LDIF | |
997 au BufNewFile,BufRead *.ldif setf ldif | |
998 | |
375 | 999 " Ld loader |
1000 au BufNewFile,BufRead *.ld setf ld | |
1001 | |
7 | 1002 " Lex |
1003 au BufNewFile,BufRead *.lex,*.l setf lex | |
1004 | |
1005 " Libao | |
2751 | 1006 au BufNewFile,BufRead */etc/libao.conf,*/.libao setf libao |
7 | 1007 |
389 | 1008 " Libsensors |
2751 | 1009 au BufNewFile,BufRead */etc/sensors.conf,*/etc/sensors3.conf setf sensors |
389 | 1010 |
7 | 1011 " LFTP |
1012 au BufNewFile,BufRead lftp.conf,.lftprc,*lftp/rc setf lftp | |
1013 | |
1014 " Lifelines (or Lex for C++!) | |
1015 au BufNewFile,BufRead *.ll setf lifelines | |
1016 | |
1017 " Lilo: Linux loader | |
2788 | 1018 au BufNewFile,BufRead lilo.conf setf lilo |
7 | 1019 |
1020 " Lisp (*.el = ELisp, *.cl = Common Lisp, *.jl = librep Lisp) | |
1021 if has("fname_case") | |
1022 au BufNewFile,BufRead *.lsp,*.lisp,*.el,*.cl,*.jl,*.L,.emacs,.sawfishrc setf lisp | |
1023 else | |
1024 au BufNewFile,BufRead *.lsp,*.lisp,*.el,*.cl,*.jl,.emacs,.sawfishrc setf lisp | |
1025 endif | |
1026 | |
375 | 1027 " SBCL implementation of Common Lisp |
1028 au BufNewFile,BufRead sbclrc,.sbclrc setf lisp | |
1029 | |
2202 | 1030 " Liquid |
1031 au BufNewFile,BufRead *.liquid setf liquid | |
1032 | |
7 | 1033 " Lite |
1034 au BufNewFile,BufRead *.lite,*.lt setf lite | |
1035 | |
1219 | 1036 " LiteStep RC files |
1037 au BufNewFile,BufRead */LiteStep/*/*.rc setf litestep | |
1038 | |
375 | 1039 " Login access |
2751 | 1040 au BufNewFile,BufRead */etc/login.access setf loginaccess |
375 | 1041 |
1042 " Login defs | |
2751 | 1043 au BufNewFile,BufRead */etc/login.defs setf logindefs |
375 | 1044 |
7 | 1045 " Logtalk |
1046 au BufNewFile,BufRead *.lgt setf logtalk | |
1047 | |
1048 " LOTOS | |
1049 au BufNewFile,BufRead *.lot,*.lotos setf lotos | |
1050 | |
1051 " Lout (also: *.lt) | |
1052 au BufNewFile,BufRead *.lou,*.lout setf lout | |
1053 | |
1054 " Lua | |
1055 au BufNewFile,BufRead *.lua setf lua | |
1056 | |
1648 | 1057 " Linden Scripting Language (Second Life) |
1058 au BufNewFile,BufRead *.lsl setf lsl | |
1059 | |
7 | 1060 " Lynx style file (or LotusScript!) |
1061 au BufNewFile,BufRead *.lss setf lss | |
1062 | |
1063 " M4 | |
1064 au BufNewFile,BufRead *.m4 | |
1065 \ if expand("<afile>") !~? 'html.m4$\|fvwm2rc' | setf m4 | endif | |
1066 | |
1067 " MaGic Point | |
1068 au BufNewFile,BufRead *.mgp setf mgp | |
1069 | |
1125 | 1070 " Mail (for Elm, trn, mutt, muttng, rn, slrn) |
1648 | 1071 au BufNewFile,BufRead snd.\d\+,.letter,.letter.\d\+,.followup,.article,.article.\d\+,pico.\d\+,mutt{ng,}-*-\w\+,mutt[[:alnum:]_-]\{6\},ae\d\+.txt,/tmp/SLRN[0-9A-Z.]\+,*.eml setf mail |
7 | 1072 |
809 | 1073 " Mail aliases |
2751 | 1074 au BufNewFile,BufRead */etc/mail/aliases,*/etc/aliases setf mailaliases |
809 | 1075 |
7 | 1076 " Mailcap configuration file |
1077 au BufNewFile,BufRead .mailcap,mailcap setf mailcap | |
1078 | |
1079 " Makefile | |
1080 au BufNewFile,BufRead *[mM]akefile,*.mk,*.mak,*.dsp setf make | |
1081 | |
1082 " MakeIndex | |
1083 au BufNewFile,BufRead *.ist,*.mst setf ist | |
1084 | |
4119 | 1085 " Mallard |
1086 au BufNewFile,BufRead *.page setf mallard | |
1087 | |
7 | 1088 " Manpage |
1089 au BufNewFile,BufRead *.man setf man | |
1090 | |
389 | 1091 " Man config |
2751 | 1092 au BufNewFile,BufRead */etc/man.conf,man.config setf manconf |
389 | 1093 |
7 | 1094 " Maple V |
1095 au BufNewFile,BufRead *.mv,*.mpl,*.mws setf maple | |
1096 | |
1668 | 1097 " Map (UMN mapserver config file) |
1098 au BufNewFile,BufRead *.map setf map | |
1099 | |
2202 | 1100 " Markdown |
1101 au BufNewFile,BufRead *.markdown,*.mdown,*.mkd,*.mkdn,README.md setf markdown | |
1102 | |
7 | 1103 " Mason |
1104 au BufNewFile,BufRead *.mason,*.mhtml setf mason | |
1105 | |
1106 " Matlab or Objective C | |
216 | 1107 au BufNewFile,BufRead *.m call s:FTm() |
7 | 1108 |
1219 | 1109 func! s:FTm() |
7 | 1110 let n = 1 |
1111 while n < 10 | |
1112 let line = getline(n) | |
2034 | 1113 if line =~ '^\s*\(#\s*\(include\|import\)\>\|/\*\|//\)' |
7 | 1114 setf objc |
1115 return | |
1116 endif | |
1117 if line =~ '^\s*%' | |
1118 setf matlab | |
1119 return | |
1120 endif | |
1121 if line =~ '^\s*(\*' | |
1122 setf mma | |
1123 return | |
1124 endif | |
1125 let n = n + 1 | |
1126 endwhile | |
271 | 1127 if exists("g:filetype_m") |
1128 exe "setf " . g:filetype_m | |
1129 else | |
1130 setf matlab | |
1131 endif | |
1219 | 1132 endfunc |
7 | 1133 |
1648 | 1134 " Mathematica notebook |
1135 au BufNewFile,BufRead *.nb setf mma | |
1136 | |
7 | 1137 " Maya Extension Language |
1138 au BufNewFile,BufRead *.mel setf mel | |
1139 | |
3750 | 1140 " Mercurial (hg) commit file |
1141 au BufNewFile,BufRead hg-editor-*.txt setf hgcommit | |
1142 | |
2034 | 1143 " Mercurial config (looks like generic config file) |
1144 au BufNewFile,BufRead *.hgrc,*hgrc setf cfg | |
1145 | |
2709 | 1146 " Messages (logs mostly) |
2788 | 1147 au BufNewFile,BufRead */log/{auth,cron,daemon,debug,kern,lpr,mail,messages,news/news,syslog,user}{,.log,.err,.info,.warn,.crit,.notice}{,.[0-9]*,-[0-9]*} setf messages |
1125 | 1148 |
7 | 1149 " Metafont |
1150 au BufNewFile,BufRead *.mf setf mf | |
1151 | |
1152 " MetaPost | |
1153 au BufNewFile,BufRead *.mp setf mp | |
1154 | |
683 | 1155 " MGL |
1156 au BufNewFile,BufRead *.mgl setf mgl | |
1157 | |
7 | 1158 " MMIX or VMS makefile |
216 | 1159 au BufNewFile,BufRead *.mms call s:FTmms() |
7 | 1160 |
1648 | 1161 " Symbian meta-makefile definition (MMP) |
1162 au BufNewFile,BufRead *.mmp setf mmp | |
1163 | |
1219 | 1164 func! s:FTmms() |
7 | 1165 let n = 1 |
1166 while n < 10 | |
1167 let line = getline(n) | |
1168 if line =~ '^\s*\(%\|//\)' || line =~ '^\*' | |
1169 setf mmix | |
1170 return | |
1171 endif | |
1172 if line =~ '^\s*#' | |
1173 setf make | |
1174 return | |
1175 endif | |
1176 let n = n + 1 | |
1177 endwhile | |
1178 setf mmix | |
1219 | 1179 endfunc |
7 | 1180 |
1181 | |
1182 " Modsim III (or LambdaProlog) | |
1183 au BufNewFile,BufRead *.mod | |
1184 \ if getline(1) =~ '\<module\>' | | |
1185 \ setf lprolog | | |
1186 \ else | | |
1187 \ setf modsim3 | | |
1188 \ endif | |
1189 | |
1190 " Modula 2 | |
1191 au BufNewFile,BufRead *.m2,*.DEF,*.MOD,*.md,*.mi setf modula2 | |
1192 | |
1193 " Modula 3 (.m3, .i3, .mg, .ig) | |
1194 au BufNewFile,BufRead *.[mi][3g] setf modula3 | |
1195 | |
1196 " Monk | |
1197 au BufNewFile,BufRead *.isc,*.monk,*.ssc,*.tsc setf monk | |
1198 | |
1199 " MOO | |
1200 au BufNewFile,BufRead *.moo setf moo | |
1201 | |
1202 " Modconf | |
2788 | 1203 au BufNewFile,BufRead */etc/modules.conf,*/etc/modules,*/etc/conf.modules setf modconf |
7 | 1204 |
1205 " Mplayer config | |
1206 au BufNewFile,BufRead mplayer.conf,*/.mplayer/config setf mplayerconf | |
1207 | |
1208 " Moterola S record | |
1209 au BufNewFile,BufRead *.s19,*.s28,*.s37 setf srec | |
1210 | |
846 | 1211 " Mrxvtrc |
1212 au BufNewFile,BufRead mrxvtrc,.mrxvtrc setf mrxvtrc | |
1213 | |
7 | 1214 " Msql |
1215 au BufNewFile,BufRead *.msql setf msql | |
1216 | |
1217 " Mysql | |
1218 au BufNewFile,BufRead *.mysql setf mysql | |
1219 | |
2788 | 1220 " Mutt setup files (must be before catch *.rc) |
1221 au BufNewFile,BufRead */etc/Muttrc.d/* call s:StarSetf('muttrc') | |
1222 | |
7 | 1223 " M$ Resource files |
3682 | 1224 au BufNewFile,BufRead *.rc,*.rch setf rc |
7 | 1225 |
12 | 1226 " MuPAD source |
1227 au BufRead,BufNewFile *.mu setf mupad | |
1228 | |
7 | 1229 " Mush |
1230 au BufNewFile,BufRead *.mush setf mush | |
1231 | |
1125 | 1232 " Mutt setup file (also for Muttng) |
1648 | 1233 au BufNewFile,BufRead Mutt{ng,}rc setf muttrc |
7 | 1234 |
389 | 1235 " Nano |
2751 | 1236 au BufNewFile,BufRead */etc/nanorc,.nanorc setf nanorc |
389 | 1237 |
7 | 1238 " Nastran input/DMAP |
1239 "au BufNewFile,BufRead *.dat setf nastran | |
1240 | |
1241 " Natural | |
1242 au BufNewFile,BufRead *.NS[ACGLMNPS] setf natural | |
1243 | |
39 | 1244 " Netrc |
1245 au BufNewFile,BufRead .netrc setf netrc | |
1246 | |
3256 | 1247 " Ninja file |
1248 au BufNewFile,BufRead *.ninja setf ninja | |
1249 | |
7 | 1250 " Novell netware batch files |
1251 au BufNewFile,BufRead *.ncf setf ncf | |
1252 | |
1253 " Nroff/Troff (*.ms and *.t are checked below) | |
1254 au BufNewFile,BufRead *.me | |
1255 \ if expand("<afile>") != "read.me" && expand("<afile>") != "click.me" | | |
1256 \ setf nroff | | |
1257 \ endif | |
1258 au BufNewFile,BufRead *.tr,*.nr,*.roff,*.tmac,*.mom setf nroff | |
216 | 1259 au BufNewFile,BufRead *.[1-9] call s:FTnroff() |
7 | 1260 |
1261 " This function checks if one of the first five lines start with a dot. In | |
1262 " that case it is probably an nroff file: 'filetype' is set and 1 is returned. | |
1219 | 1263 func! s:FTnroff() |
7 | 1264 if getline(1)[0] . getline(2)[0] . getline(3)[0] . getline(4)[0] . getline(5)[0] =~ '\.' |
1265 setf nroff | |
1266 return 1 | |
1267 endif | |
1268 return 0 | |
1219 | 1269 endfunc |
7 | 1270 |
1271 " Nroff or Objective C++ | |
216 | 1272 au BufNewFile,BufRead *.mm call s:FTmm() |
7 | 1273 |
1219 | 1274 func! s:FTmm() |
7 | 1275 let n = 1 |
1276 while n < 10 | |
1277 let line = getline(n) | |
1278 if line =~ '^\s*\(#\s*\(include\|import\)\>\|/\*\)' | |
1279 setf objcpp | |
1280 return | |
1281 endif | |
1282 let n = n + 1 | |
1283 endwhile | |
1284 setf nroff | |
1219 | 1285 endfunc |
7 | 1286 |
1287 " Not Quite C | |
1288 au BufNewFile,BufRead *.nqc setf nqc | |
1289 | |
1290 " NSIS | |
3492 | 1291 au BufNewFile,BufRead *.nsi,*.nsh setf nsis |
7 | 1292 |
1293 " OCAML | |
3312 | 1294 au BufNewFile,BufRead *.ml,*.mli,*.mll,*.mly,.ocamlinit setf ocaml |
7 | 1295 |
1296 " Occam | |
1297 au BufNewFile,BufRead *.occ setf occam | |
1298 | |
1299 " Omnimark | |
1300 au BufNewFile,BufRead *.xom,*.xin setf omnimark | |
1301 | |
1302 " OpenROAD | |
1303 au BufNewFile,BufRead *.or setf openroad | |
1304 | |
1305 " OPL | |
1306 au BufNewFile,BufRead *.[Oo][Pp][Ll] setf opl | |
1307 | |
1308 " Oracle config file | |
1309 au BufNewFile,BufRead *.ora setf ora | |
1310 | |
1311 " Packet filter conf | |
1312 au BufNewFile,BufRead pf.conf setf pf | |
1313 | |
375 | 1314 " Pam conf |
2751 | 1315 au BufNewFile,BufRead */etc/pam.conf setf pamconf |
375 | 1316 |
7 | 1317 " PApp |
1318 au BufNewFile,BufRead *.papp,*.pxml,*.pxsl setf papp | |
1319 | |
389 | 1320 " Password file |
2751 | 1321 au BufNewFile,BufRead */etc/passwd,*/etc/passwd-,*/etc/passwd.edit,*/etc/shadow,*/etc/shadow-,*/etc/shadow.edit,*/var/backups/passwd.bak,*/var/backups/shadow.bak setf passwd |
389 | 1322 |
7 | 1323 " Pascal (also *.p) |
1324 au BufNewFile,BufRead *.pas setf pascal | |
1325 | |
1326 " Delphi project file | |
1327 au BufNewFile,BufRead *.dpr setf pascal | |
1328 | |
1648 | 1329 " PDF |
1330 au BufNewFile,BufRead *.pdf setf pdf | |
1331 | |
7 | 1332 " Perl |
1333 if has("fname_case") | |
216 | 1334 au BufNewFile,BufRead *.pl,*.PL call s:FTpl() |
7 | 1335 else |
216 | 1336 au BufNewFile,BufRead *.pl call s:FTpl() |
7 | 1337 endif |
2034 | 1338 au BufNewFile,BufRead *.plx,*.al setf perl |
2439 | 1339 au BufNewFile,BufRead *.p6,*.pm6 setf perl6 |
7 | 1340 |
1219 | 1341 func! s:FTpl() |
7 | 1342 if exists("g:filetype_pl") |
1343 exe "setf " . g:filetype_pl | |
1344 else | |
1345 " recognize Prolog by specific text in the first non-empty line | |
1346 " require a blank after the '%' because Perl uses "%list" and "%translate" | |
1347 let l = getline(nextnonblank(1)) | |
1348 if l =~ '\<prolog\>' || l =~ '^\s*\(%\+\(\s\|$\)\|/\*\)' || l =~ ':-' | |
1349 setf prolog | |
1350 else | |
1351 setf perl | |
1352 endif | |
1353 endif | |
1219 | 1354 endfunc |
7 | 1355 |
1356 " Perl, XPM or XPM2 | |
1357 au BufNewFile,BufRead *.pm | |
1358 \ if getline(1) =~ "XPM2" | | |
1359 \ setf xpm2 | | |
1360 \ elseif getline(1) =~ "XPM" | | |
1361 \ setf xpm | | |
1362 \ else | | |
1363 \ setf perl | | |
1364 \ endif | |
1365 | |
1366 " Perl POD | |
1367 au BufNewFile,BufRead *.pod setf pod | |
1368 | |
850 | 1369 " Php, php3, php4, etc. |
1648 | 1370 " Also Phtml (was used for PHP 2 in the past) |
1371 " Also .ctp for Cake template file | |
1372 au BufNewFile,BufRead *.php,*.php\d,*.phtml,*.ctp setf php | |
7 | 1373 |
1374 " Pike | |
1375 au BufNewFile,BufRead *.pike,*.lpc,*.ulpc,*.pmod setf pike | |
1376 | |
1377 " Pinfo config | |
1378 au BufNewFile,BufRead */etc/pinforc,*/.pinforc setf pinfo | |
1379 | |
1380 " Palm Resource compiler | |
1381 au BufNewFile,BufRead *.rcp setf pilrc | |
1382 | |
1383 " Pine config | |
1384 au BufNewFile,BufRead .pinerc,pinerc,.pinercex,pinercex setf pine | |
1385 | |
1386 " PL/M (also: *.inp) | |
1387 au BufNewFile,BufRead *.plm,*.p36,*.pac setf plm | |
1388 | |
1389 " PL/SQL | |
1390 au BufNewFile,BufRead *.pls,*.plsql setf plsql | |
1391 | |
1392 " PLP | |
1393 au BufNewFile,BufRead *.plp setf plp | |
1394 | |
1395 " PO and PO template (GNU gettext) | |
1396 au BufNewFile,BufRead *.po,*.pot setf po | |
1397 | |
1398 " Postfix main config | |
1399 au BufNewFile,BufRead main.cf setf pfmain | |
1400 | |
1401 " PostScript (+ font files, encapsulated PostScript, Adobe Illustrator) | |
1402 au BufNewFile,BufRead *.ps,*.pfa,*.afm,*.eps,*.epsf,*.epsi,*.ai setf postscr | |
1403 | |
1404 " PostScript Printer Description | |
1405 au BufNewFile,BufRead *.ppd setf ppd | |
1406 | |
1407 " Povray | |
1408 au BufNewFile,BufRead *.pov setf pov | |
1409 | |
1410 " Povray configuration | |
1411 au BufNewFile,BufRead .povrayrc setf povini | |
1412 | |
1413 " Povray, PHP or assembly | |
216 | 1414 au BufNewFile,BufRead *.inc call s:FTinc() |
7 | 1415 |
1219 | 1416 func! s:FTinc() |
7 | 1417 if exists("g:filetype_inc") |
1418 exe "setf " . g:filetype_inc | |
1419 else | |
1420 let lines = getline(1).getline(2).getline(3) | |
1421 if lines =~? "perlscript" | |
1422 setf aspperl | |
1423 elseif lines =~ "<%" | |
1424 setf aspvbs | |
1425 elseif lines =~ "<?" | |
1426 setf php | |
1427 else | |
216 | 1428 call s:FTasmsyntax() |
7 | 1429 if exists("b:asmsyntax") |
1698 | 1430 exe "setf " . fnameescape(b:asmsyntax) |
7 | 1431 else |
1432 setf pov | |
1433 endif | |
1434 endif | |
1435 endif | |
1219 | 1436 endfunc |
7 | 1437 |
1438 " Printcap and Termcap | |
1439 au BufNewFile,BufRead *printcap | |
1440 \ let b:ptcap_type = "print" | setf ptcap | |
1441 au BufNewFile,BufRead *termcap | |
1442 \ let b:ptcap_type = "term" | setf ptcap | |
1443 | |
1444 " PCCTS / ANTRL | |
1445 "au BufNewFile,BufRead *.g setf antrl | |
1446 au BufNewFile,BufRead *.g setf pccts | |
1447 | |
1448 " PPWizard | |
1449 au BufNewFile,BufRead *.it,*.ih setf ppwiz | |
1450 | |
2152 | 1451 " Obj 3D file format |
1452 " TODO: is there a way to avoid MS-Windows Object files? | |
2725 | 1453 au BufNewFile,BufRead *.obj setf obj |
2152 | 1454 |
7 | 1455 " Oracle Pro*C/C++ |
1287 | 1456 au BufNewFile,BufRead *.pc setf proc |
7 | 1457 |
1125 | 1458 " Privoxy actions file |
1459 au BufNewFile,BufRead *.action setf privoxy | |
1460 | |
7 | 1461 " Procmail |
1462 au BufNewFile,BufRead .procmail,.procmailrc setf procmail | |
1463 | |
1464 " Progress or CWEB | |
216 | 1465 au BufNewFile,BufRead *.w call s:FTprogress_cweb() |
7 | 1466 |
1219 | 1467 func! s:FTprogress_cweb() |
7 | 1468 if exists("g:filetype_w") |
1469 exe "setf " . g:filetype_w | |
1470 return | |
1471 endif | |
1472 if getline(1) =~ '&ANALYZE' || getline(3) =~ '&GLOBAL-DEFINE' | |
1473 setf progress | |
1474 else | |
1475 setf cweb | |
1476 endif | |
1219 | 1477 endfunc |
7 | 1478 |
1479 " Progress or assembly | |
216 | 1480 au BufNewFile,BufRead *.i call s:FTprogress_asm() |
7 | 1481 |
1219 | 1482 func! s:FTprogress_asm() |
7 | 1483 if exists("g:filetype_i") |
1484 exe "setf " . g:filetype_i | |
1485 return | |
1486 endif | |
1487 " This function checks for an assembly comment the first ten lines. | |
1488 " If not found, assume Progress. | |
1489 let lnum = 1 | |
500 | 1490 while lnum <= 10 && lnum < line('$') |
7 | 1491 let line = getline(lnum) |
1492 if line =~ '^\s*;' || line =~ '^\*' | |
216 | 1493 call s:FTasm() |
7 | 1494 return |
1495 elseif line !~ '^\s*$' || line =~ '^/\*' | |
1496 " Not an empty line: Doesn't look like valid assembly code. | |
1497 " Or it looks like a Progress /* comment | |
1498 break | |
1499 endif | |
1500 let lnum = lnum + 1 | |
1501 endw | |
1502 setf progress | |
1219 | 1503 endfunc |
7 | 1504 |
1505 " Progress or Pascal | |
216 | 1506 au BufNewFile,BufRead *.p call s:FTprogress_pascal() |
7 | 1507 |
1219 | 1508 func! s:FTprogress_pascal() |
7 | 1509 if exists("g:filetype_p") |
1510 exe "setf " . g:filetype_p | |
1511 return | |
1512 endif | |
1513 " This function checks for valid Pascal syntax in the first ten lines. | |
1514 " Look for either an opening comment or a program start. | |
1515 " If not found, assume Progress. | |
1516 let lnum = 1 | |
500 | 1517 while lnum <= 10 && lnum < line('$') |
7 | 1518 let line = getline(lnum) |
500 | 1519 if line =~ '^\s*\(program\|unit\|procedure\|function\|const\|type\|var\)\>' |
7 | 1520 \ || line =~ '^\s*{' || line =~ '^\s*(\*' |
1521 setf pascal | |
1522 return | |
1523 elseif line !~ '^\s*$' || line =~ '^/\*' | |
1524 " Not an empty line: Doesn't look like valid Pascal code. | |
1525 " Or it looks like a Progress /* comment | |
1526 break | |
1527 endif | |
1528 let lnum = lnum + 1 | |
1529 endw | |
1530 setf progress | |
1219 | 1531 endfunc |
7 | 1532 |
1533 | |
1534 " Software Distributor Product Specification File (POSIX 1387.2-1995) | |
1535 au BufNewFile,BufRead *.psf setf psf | |
1536 au BufNewFile,BufRead INDEX,INFO | |
1537 \ if getline(1) =~ '^\s*\(distribution\|installed_software\|root\|bundle\|product\)\s*$' | | |
1538 \ setf psf | | |
1539 \ endif | |
1540 | |
1541 " Prolog | |
1542 au BufNewFile,BufRead *.pdb setf prolog | |
1543 | |
1648 | 1544 " Promela |
1545 au BufNewFile,BufRead *.pml setf promela | |
1546 | |
389 | 1547 " Protocols |
2751 | 1548 au BufNewFile,BufRead */etc/protocols setf protocols |
389 | 1549 |
7 | 1550 " Pyrex |
1551 au BufNewFile,BufRead *.pyx,*.pxd setf pyrex | |
1552 | |
1553 " Python | |
1554 au BufNewFile,BufRead *.py,*.pyw setf python | |
1555 | |
1676 | 1556 " Quixote (Python-based web framework) |
1557 au BufNewFile,BufRead *.ptl setf python | |
1558 | |
7 | 1559 " Radiance |
1560 au BufNewFile,BufRead *.rad,*.mat setf radiance | |
1561 | |
1562 " Ratpoison config/command files | |
1563 au BufNewFile,BufRead .ratpoisonrc,ratpoisonrc setf ratpoison | |
1564 | |
1565 " RCS file | |
1566 au BufNewFile,BufRead *\,v setf rcs | |
1567 | |
1568 " Readline | |
237 | 1569 au BufNewFile,BufRead .inputrc,inputrc setf readline |
7 | 1570 |
1571 " Registry for MS-Windows | |
1572 au BufNewFile,BufRead *.reg | |
1573 \ if getline(1) =~? '^REGEDIT[0-9]*\s*$\|^Windows Registry Editor Version \d*\.\d*\s*$' | setf registry | endif | |
1574 | |
1575 " Renderman Interface Bytestream | |
1576 au BufNewFile,BufRead *.rib setf rib | |
1577 | |
1578 " Rexx | |
3893 | 1579 au BufNewFile,BufRead *.rex,*.orx,*.rxo,*.rxj,*.jrexx,*.rexxj,*.rexx,*.testGroup,*.testUnit setf rexx |
7 | 1580 |
1581 " R (Splus) | |
836 | 1582 if has("fname_case") |
1583 au BufNewFile,BufRead *.s,*.S setf r | |
1584 else | |
1585 au BufNewFile,BufRead *.s setf r | |
1586 endif | |
7 | 1587 |
699 | 1588 " R Help file |
836 | 1589 if has("fname_case") |
1590 au BufNewFile,BufRead *.rd,*.Rd setf rhelp | |
1591 else | |
1592 au BufNewFile,BufRead *.rd setf rhelp | |
1593 endif | |
1594 | |
1595 " R noweb file | |
1596 if has("fname_case") | |
1597 au BufNewFile,BufRead *.Rnw,*.rnw,*.Snw,*.snw setf rnoweb | |
1598 else | |
1599 au BufNewFile,BufRead *.rnw,*.snw setf rnoweb | |
1600 endif | |
699 | 1601 |
7 | 1602 " Rexx, Rebol or R |
216 | 1603 au BufNewFile,BufRead *.r,*.R call s:FTr() |
7 | 1604 |
1219 | 1605 func! s:FTr() |
1125 | 1606 let max = line("$") > 50 ? 50 : line("$") |
1607 | |
1608 for n in range(1, max) | |
1609 " Rebol is easy to recognize, check for that first | |
1648 | 1610 if getline(n) =~? '\<REBOL\>' |
1125 | 1611 setf rebol |
1612 return | |
7 | 1613 endif |
1125 | 1614 endfor |
1615 | |
1616 for n in range(1, max) | |
1617 " R has # comments | |
1618 if getline(n) =~ '^\s*#' | |
1619 setf r | |
1620 return | |
1621 endif | |
1622 " Rexx has /* comments */ | |
1623 if getline(n) =~ '^\s*/\*' | |
7 | 1624 setf rexx |
1125 | 1625 return |
7 | 1626 endif |
1125 | 1627 endfor |
1628 | |
2965 | 1629 " Nothing recognized, use user default or assume Rexx |
1630 if exists("g:filetype_r") | |
1631 exe "setf " . g:filetype_r | |
1632 else | |
1633 " Rexx used to be the default, but R appears to be much more popular. | |
1634 setf r | |
1635 endif | |
1219 | 1636 endfunc |
7 | 1637 |
4159 | 1638 " ReDIF |
1639 au BufRead,BufNewFile *.rdf setf redif | |
1640 | |
7 | 1641 " Remind |
2788 | 1642 au BufNewFile,BufRead .reminders,*.remind,*.rem setf remind |
7 | 1643 |
1644 " Resolv.conf | |
1645 au BufNewFile,BufRead resolv.conf setf resolv | |
1646 | |
1647 " Relax NG Compact | |
1648 au BufNewFile,BufRead *.rnc setf rnc | |
1649 | |
1650 " RPL/2 | |
1651 au BufNewFile,BufRead *.rpl setf rpl | |
1652 | |
1653 " Robots.txt | |
1654 au BufNewFile,BufRead robots.txt setf robots | |
1655 | |
1656 " Rpcgen | |
1657 au BufNewFile,BufRead *.x setf rpcgen | |
1658 | |
1659 " reStructuredText Documentation Format | |
1660 au BufNewFile,BufRead *.rst setf rst | |
1661 | |
1662 " RTF | |
1663 au BufNewFile,BufRead *.rtf setf rtf | |
1664 | |
1676 | 1665 " Interactive Ruby shell |
1666 au BufNewFile,BufRead .irbrc,irbrc setf ruby | |
1667 | |
7 | 1668 " Ruby |
2681 | 1669 au BufNewFile,BufRead *.rb,*.rbw setf ruby |
1670 | |
1671 " RubyGems | |
1672 au BufNewFile,BufRead *.gemspec setf ruby | |
1673 | |
1674 " Rackup | |
1675 au BufNewFile,BufRead *.ru setf ruby | |
1676 | |
1677 " Bundler | |
1678 au BufNewFile,BufRead Gemfile setf ruby | |
7 | 1679 |
1219 | 1680 " Ruby on Rails |
1681 au BufNewFile,BufRead *.builder,*.rxml,*.rjs setf ruby | |
1682 | |
1683 " Rantfile and Rakefile is like Ruby | |
1684 au BufNewFile,BufRead [rR]antfile,*.rant,[rR]akefile,*.rake setf ruby | |
557 | 1685 |
2034 | 1686 " S-lang (or shader language, or SmallLisp) |
7 | 1687 au BufNewFile,BufRead *.sl setf slang |
1688 | |
1689 " Samba config | |
1690 au BufNewFile,BufRead smb.conf setf samba | |
1691 | |
1692 " SAS script | |
1693 au BufNewFile,BufRead *.sas setf sas | |
1694 | |
1668 | 1695 " Sass |
1696 au BufNewFile,BufRead *.sass setf sass | |
1697 | |
7 | 1698 " Sather |
1699 au BufNewFile,BufRead *.sa setf sather | |
1700 | |
1701 " Scilab | |
809 | 1702 au BufNewFile,BufRead *.sci,*.sce setf scilab |
7 | 1703 |
2415 | 1704 " SCSS |
2725 | 1705 au BufNewFile,BufRead *.scss setf scss |
2415 | 1706 |
1125 | 1707 " SD: Streaming Descriptors |
1708 au BufNewFile,BufRead *.sd setf sd | |
1709 | |
7 | 1710 " SDL |
1711 au BufNewFile,BufRead *.sdl,*.pr setf sdl | |
1712 | |
1713 " sed | |
1714 au BufNewFile,BufRead *.sed setf sed | |
1715 | |
36 | 1716 " Sieve (RFC 3028) |
1717 au BufNewFile,BufRead *.siv setf sieve | |
1718 | |
7 | 1719 " Sendmail |
1720 au BufNewFile,BufRead sendmail.cf setf sm | |
1721 | |
1648 | 1722 " Sendmail .mc files are actually m4. Could also be MS Message text file. |
1723 au BufNewFile,BufRead *.mc call s:McSetf() | |
1724 | |
1725 func! s:McSetf() | |
1726 " Rely on the file to start with a comment. | |
1727 " MS message text files use ';', Sendmail files use '#' or 'dnl' | |
1728 for lnum in range(1, min([line("$"), 20])) | |
1729 let line = getline(lnum) | |
1730 if line =~ '^\s*\(#\|dnl\)' | |
1731 setf m4 " Sendmail .mc file | |
1732 return | |
1733 elseif line =~ '^\s*;' | |
1734 setf msmessages " MS Message text file | |
1735 return | |
1736 endif | |
1737 endfor | |
1738 setf m4 " Default: Sendmail .mc file | |
1739 endfunc | |
7 | 1740 |
389 | 1741 " Services |
2751 | 1742 au BufNewFile,BufRead */etc/services setf services |
389 | 1743 |
1744 " Service Location config | |
2751 | 1745 au BufNewFile,BufRead */etc/slp.conf setf slpconf |
389 | 1746 |
1747 " Service Location registration | |
2751 | 1748 au BufNewFile,BufRead */etc/slp.reg setf slpreg |
389 | 1749 |
1750 " Service Location SPI | |
2751 | 1751 au BufNewFile,BufRead */etc/slp.spi setf slpspi |
389 | 1752 |
1753 " Setserial config | |
2751 | 1754 au BufNewFile,BufRead */etc/serial.conf setf setserial |
389 | 1755 |
7 | 1756 " SGML |
1757 au BufNewFile,BufRead *.sgm,*.sgml | |
1758 \ if getline(1).getline(2).getline(3).getline(4).getline(5) =~? 'linuxdoc' | | |
1759 \ setf sgmllnx | | |
1760 \ elseif getline(1) =~ '<!DOCTYPE.*DocBook' || getline(2) =~ '<!DOCTYPE.*DocBook' | | |
3967 | 1761 \ let b:docbk_type = "sgml" | |
1762 \ let b:docbk_ver = 4 | | |
7 | 1763 \ setf docbk | |
1764 \ else | | |
1765 \ setf sgml | | |
1766 \ endif | |
1767 | |
1768 " SGMLDECL | |
1769 au BufNewFile,BufRead *.decl,*.dcl,*.dec | |
1770 \ if getline(1).getline(2).getline(3) =~? '^<!SGML' | | |
1771 \ setf sgmldecl | | |
1772 \ endif | |
1773 | |
1774 " SGML catalog file | |
216 | 1775 au BufNewFile,BufRead catalog setf catalog |
1776 au BufNewFile,BufRead sgml.catalog* call s:StarSetf('catalog') | |
7 | 1777 |
1778 " Shell scripts (sh, ksh, bash, bash2, csh); Allow .profile_foo etc. | |
1779 " Gentoo ebuilds are actually bash scripts | |
1780 au BufNewFile,BufRead .bashrc*,bashrc,bash.bashrc,.bash_profile*,.bash_logout*,*.bash,*.ebuild call SetFileTypeSH("bash") | |
1781 au BufNewFile,BufRead .kshrc*,*.ksh call SetFileTypeSH("ksh") | |
2751 | 1782 au BufNewFile,BufRead */etc/profile,.profile*,*.sh,*.env call SetFileTypeSH(getline(1)) |
7 | 1783 |
216 | 1784 " Also called from scripts.vim. |
1219 | 1785 func! SetFileTypeSH(name) |
216 | 1786 if expand("<amatch>") =~ g:ft_ignore_pat |
1787 return | |
1788 endif | |
2034 | 1789 if a:name =~ '\<csh\>' |
1790 " Some .sh scripts contain #!/bin/csh. | |
1791 call SetFileTypeShell("csh") | |
1792 return | |
1793 elseif a:name =~ '\<tcsh\>' | |
1794 " Some .sh scripts contain #!/bin/tcsh. | |
1795 call SetFileTypeShell("tcsh") | |
1796 return | |
3830 | 1797 elseif a:name =~ '\<zsh\>' |
1798 " Some .sh scripts contain #!/bin/zsh. | |
1799 call SetFileTypeShell("zsh") | |
1800 return | |
2034 | 1801 elseif a:name =~ '\<ksh\>' |
7 | 1802 let b:is_kornshell = 1 |
1803 if exists("b:is_bash") | |
1804 unlet b:is_bash | |
1805 endif | |
1806 if exists("b:is_sh") | |
1807 unlet b:is_sh | |
1808 endif | |
1809 elseif exists("g:bash_is_sh") || a:name =~ '\<bash\>' || a:name =~ '\<bash2\>' | |
1810 let b:is_bash = 1 | |
1811 if exists("b:is_kornshell") | |
1812 unlet b:is_kornshell | |
1813 endif | |
1814 if exists("b:is_sh") | |
1815 unlet b:is_sh | |
1816 endif | |
1817 elseif a:name =~ '\<sh\>' | |
1818 let b:is_sh = 1 | |
1819 if exists("b:is_kornshell") | |
1820 unlet b:is_kornshell | |
1821 endif | |
1822 if exists("b:is_bash") | |
1823 unlet b:is_bash | |
1824 endif | |
1825 endif | |
26 | 1826 call SetFileTypeShell("sh") |
1219 | 1827 endfunc |
26 | 1828 |
1829 " For shell-like file types, check for an "exec" command hidden in a comment, | |
1830 " as used for Tcl. | |
216 | 1831 " Also called from scripts.vim, thus can't be local to this script. |
1219 | 1832 func! SetFileTypeShell(name) |
216 | 1833 if expand("<amatch>") =~ g:ft_ignore_pat |
1834 return | |
1835 endif | |
26 | 1836 let l = 2 |
1837 while l < 20 && l < line("$") && getline(l) =~ '^\s*\(#\|$\)' | |
1838 " Skip empty and comment lines. | |
1839 let l = l + 1 | |
1840 endwhile | |
1841 if l < line("$") && getline(l) =~ '\s*exec\s' && getline(l - 1) =~ '^\s*#.*\\$' | |
1842 " Found an "exec" line after a comment with continuation | |
1843 let n = substitute(getline(l),'\s*exec\s\+\([^ ]*/\)\=', '', '') | |
1844 if n =~ '\<tclsh\|\<wish' | |
1845 setf tcl | |
1846 return | |
1847 endif | |
1848 endif | |
1849 exe "setf " . a:name | |
1219 | 1850 endfunc |
7 | 1851 |
1852 " tcsh scripts | |
26 | 1853 au BufNewFile,BufRead .tcshrc*,*.tcsh,tcsh.tcshrc,tcsh.login call SetFileTypeShell("tcsh") |
7 | 1854 |
1855 " csh scripts, but might also be tcsh scripts (on some systems csh is tcsh) | |
216 | 1856 au BufNewFile,BufRead .login*,.cshrc*,csh.cshrc,csh.login,csh.logout,*.csh,.alias call s:CSH() |
7 | 1857 |
1219 | 1858 func! s:CSH() |
7 | 1859 if exists("g:filetype_csh") |
26 | 1860 call SetFileTypeShell(g:filetype_csh) |
7 | 1861 elseif &shell =~ "tcsh" |
26 | 1862 call SetFileTypeShell("tcsh") |
7 | 1863 else |
26 | 1864 call SetFileTypeShell("csh") |
7 | 1865 endif |
1219 | 1866 endfunc |
7 | 1867 |
1868 " Z-Shell script | |
2751 | 1869 au BufNewFile,BufRead .zprofile,*/etc/zprofile,.zfbfmarks setf zsh |
216 | 1870 au BufNewFile,BufRead .zsh*,.zlog*,.zcompdump* call s:StarSetf('zsh') |
2725 | 1871 au BufNewFile,BufRead *.zsh setf zsh |
7 | 1872 |
1873 " Scheme | |
3513 | 1874 au BufNewFile,BufRead *.scm,*.ss,*.rkt setf scheme |
7 | 1875 |
1876 " Screen RC | |
1877 au BufNewFile,BufRead .screenrc,screenrc setf screen | |
1878 | |
1879 " Simula | |
1880 au BufNewFile,BufRead *.sim setf simula | |
1881 | |
1882 " SINDA | |
1883 au BufNewFile,BufRead *.sin,*.s85 setf sinda | |
1884 | |
819 | 1885 " SiSU |
857 | 1886 au BufNewFile,BufRead *.sst,*.ssm,*.ssi,*.-sst,*._sst setf sisu |
819 | 1887 au BufNewFile,BufRead *.sst.meta,*.-sst.meta,*._sst.meta setf sisu |
1888 | |
7 | 1889 " SKILL |
336 | 1890 au BufNewFile,BufRead *.il,*.ils,*.cdf setf skill |
7 | 1891 |
1892 " SLRN | |
1893 au BufNewFile,BufRead .slrnrc setf slrnrc | |
1894 au BufNewFile,BufRead *.score setf slrnsc | |
1895 | |
271 | 1896 " Smalltalk (and TeX) |
1897 au BufNewFile,BufRead *.st setf st | |
1898 au BufNewFile,BufRead *.cls | |
1899 \ if getline(1) =~ '^%' | | |
1900 \ setf tex | | |
3893 | 1901 \ elseif getline(1)[0] == '#' && getline(1) =~ 'rexx' | |
1902 \ setf rexx | | |
271 | 1903 \ else | |
1904 \ setf st | | |
1905 \ endif | |
7 | 1906 |
1907 " Smarty templates | |
1908 au BufNewFile,BufRead *.tpl setf smarty | |
1909 | |
1910 " SMIL or XML | |
1911 au BufNewFile,BufRead *.smil | |
1912 \ if getline(1) =~ '<?\s*xml.*?>' | | |
1913 \ setf xml | | |
1914 \ else | | |
1915 \ setf smil | | |
1916 \ endif | |
1917 | |
1918 " SMIL or SNMP MIB file | |
1919 au BufNewFile,BufRead *.smi | |
1920 \ if getline(1) =~ '\<smil\>' | | |
1921 \ setf smil | | |
1922 \ else | | |
1923 \ setf mib | | |
1924 \ endif | |
1925 | |
1926 " SMITH | |
1927 au BufNewFile,BufRead *.smt,*.smith setf smith | |
1928 | |
857 | 1929 " Snobol4 and spitbol |
1930 au BufNewFile,BufRead *.sno,*.spt setf snobol4 | |
7 | 1931 |
1932 " SNMP MIB files | |
1933 au BufNewFile,BufRead *.mib,*.my setf mib | |
1934 | |
1935 " Snort Configuration | |
1219 | 1936 au BufNewFile,BufRead *.hog,snort.conf,vision.conf setf hog |
1937 au BufNewFile,BufRead *.rules call s:FTRules() | |
1938 | |
1939 let s:ft_rules_udev_rules_pattern = '^\s*\cudev_rules\s*=\s*"\([^"]\{-1,}\)/*".*' | |
1940 func! s:FTRules() | |
2034 | 1941 let path = expand('<amatch>:p') |
2751 | 1942 if path =~ '^/\(etc/udev/\%(rules\.d/\)\=.*\.rules\|lib/udev/\%(rules\.d/\)\=.*\.rules\)$' |
1648 | 1943 setf udevrules |
1944 return | |
1945 endif | |
2034 | 1946 if path =~ '^/etc/ufw/' |
1947 setf conf " Better than hog | |
1948 return | |
1949 endif | |
1219 | 1950 try |
1951 let config_lines = readfile('/etc/udev/udev.conf') | |
1952 catch /^Vim\%((\a\+)\)\=:E484/ | |
1953 setf hog | |
1954 return | |
1955 endtry | |
1648 | 1956 let dir = expand('<amatch>:p:h') |
1219 | 1957 for line in config_lines |
1958 if line =~ s:ft_rules_udev_rules_pattern | |
1959 let udev_rules = substitute(line, s:ft_rules_udev_rules_pattern, '\1', "") | |
1648 | 1960 if dir == udev_rules |
1219 | 1961 setf udevrules |
1962 endif | |
1963 break | |
1964 endif | |
1965 endfor | |
1966 setf hog | |
1967 endfunc | |
1968 | |
7 | 1969 |
1970 " Spec (Linux RPM) | |
1971 au BufNewFile,BufRead *.spec setf spec | |
1972 | |
1973 " Speedup (AspenTech plant simulator) | |
1974 au BufNewFile,BufRead *.speedup,*.spdata,*.spd setf spup | |
1975 | |
1976 " Slice | |
1977 au BufNewFile,BufRead *.ice setf slice | |
1978 | |
1979 " Spice | |
1980 au BufNewFile,BufRead *.sp,*.spice setf spice | |
1981 | |
1982 " Spyce | |
1983 au BufNewFile,BufRead *.spy,*.spi setf spyce | |
1984 | |
1985 " Squid | |
1986 au BufNewFile,BufRead squid.conf setf squid | |
1987 | |
22 | 1988 " SQL for Oracle Designer |
1989 au BufNewFile,BufRead *.tyb,*.typ,*.tyc,*.pkb,*.pks setf sql | |
1990 | |
1991 " SQL | |
216 | 1992 au BufNewFile,BufRead *.sql call s:SQL() |
22 | 1993 |
1219 | 1994 func! s:SQL() |
22 | 1995 if exists("g:filetype_sql") |
1996 exe "setf " . g:filetype_sql | |
1997 else | |
1998 setf sql | |
1999 endif | |
1219 | 2000 endfunc |
7 | 2001 |
2002 " SQLJ | |
2003 au BufNewFile,BufRead *.sqlj setf sqlj | |
2004 | |
2005 " SQR | |
2006 au BufNewFile,BufRead *.sqr,*.sqi setf sqr | |
2007 | |
2008 " OpenSSH configuration | |
2009 au BufNewFile,BufRead ssh_config,*/.ssh/config setf sshconfig | |
2010 | |
2011 " OpenSSH server configuration | |
2012 au BufNewFile,BufRead sshd_config setf sshdconfig | |
2013 | |
831 | 2014 " Stata |
2015 au BufNewFile,BufRead *.ado,*.class,*.do,*.imata,*.mata setf stata | |
2016 | |
2017 " SMCL | |
2018 au BufNewFile,BufRead *.hlp,*.ihlp,*.smcl setf smcl | |
2019 | |
7 | 2020 " Stored Procedures |
2021 au BufNewFile,BufRead *.stp setf stp | |
2022 | |
2023 " Standard ML | |
2024 au BufNewFile,BufRead *.sml setf sml | |
2025 | |
1648 | 2026 " Sratus VOS command macro |
2027 au BufNewFile,BufRead *.cm setf voscm | |
2028 | |
375 | 2029 " Sysctl |
2751 | 2030 au BufNewFile,BufRead */etc/sysctl.conf,*/etc/sysctl.d/*.conf setf sysctl |
375 | 2031 |
2034 | 2032 " Synopsys Design Constraints |
2033 au BufNewFile,BufRead *.sdc setf sdc | |
2034 | |
39 | 2035 " Sudoers |
2751 | 2036 au BufNewFile,BufRead */etc/sudoers,sudoers.tmp setf sudoers |
39 | 2037 |
2152 | 2038 " SVG (Scalable Vector Graphics) |
2039 au BufNewFile,BufRead *.svg setf svg | |
2040 | |
826 | 2041 " If the file has an extension of 't' and is in a directory 't' then it is |
2042 " almost certainly a Perl test file. | |
557 | 2043 " If the first line starts with '#' and contains 'perl' it's probably a Perl |
2044 " file. | |
826 | 2045 " (Slow test) If a file contains a 'use' statement then it is almost certainly |
2046 " a Perl file. | |
1219 | 2047 func! s:FTperl() |
826 | 2048 if expand("%:e") == 't' && expand("%:p:h:t") == 't' |
2049 setf perl | |
2050 return 1 | |
2051 endif | |
557 | 2052 if getline(1)[0] == '#' && getline(1) =~ 'perl' |
2053 setf perl | |
2054 return 1 | |
2055 endif | |
826 | 2056 if search('^use\s\s*\k', 'nc', 30) |
2057 setf perl | |
2058 return 1 | |
2059 endif | |
557 | 2060 return 0 |
1219 | 2061 endfunc |
557 | 2062 |
2063 " Tads (or Nroff or Perl test file) | |
7 | 2064 au BufNewFile,BufRead *.t |
557 | 2065 \ if !s:FTnroff() && !s:FTperl() | setf tads | endif |
7 | 2066 |
2067 " Tags | |
2068 au BufNewFile,BufRead tags setf tags | |
2069 | |
2070 " TAK | |
2071 au BufNewFile,BufRead *.tak setf tak | |
2072 | |
2034 | 2073 " Task |
2074 au BufRead,BufNewFile {pending,completed,undo}.data setf taskdata | |
2075 au BufRead,BufNewFile *.task setf taskedit | |
2076 | |
557 | 2077 " Tcl (JACL too) |
2078 au BufNewFile,BufRead *.tcl,*.tk,*.itcl,*.itk,*.jacl setf tcl | |
7 | 2079 |
2080 " TealInfo | |
2081 au BufNewFile,BufRead *.tli setf tli | |
2082 | |
2083 " Telix Salt | |
2084 au BufNewFile,BufRead *.slt setf tsalt | |
2085 | |
2086 " Terminfo | |
2087 au BufNewFile,BufRead *.ti setf terminfo | |
2088 | |
2089 " TeX | |
378 | 2090 au BufNewFile,BufRead *.latex,*.sty,*.dtx,*.ltx,*.bbl setf tex |
2091 au BufNewFile,BufRead *.tex call s:FTtex() | |
2092 | |
800 | 2093 " Choose context, plaintex, or tex (LaTeX) based on these rules: |
2094 " 1. Check the first line of the file for "%&<format>". | |
2095 " 2. Check the first 1000 non-comment lines for LaTeX or ConTeXt keywords. | |
2096 " 3. Default to "latex" or to g:tex_flavor, can be set in user's vimrc. | |
1219 | 2097 func! s:FTtex() |
800 | 2098 let firstline = getline(1) |
2099 if firstline =~ '^%&\s*\a\+' | |
2100 let format = tolower(matchstr(firstline, '\a\+')) | |
2101 let format = substitute(format, 'pdf', '', '') | |
2102 if format == 'tex' | |
2103 let format = 'plain' | |
378 | 2104 endif |
800 | 2105 else |
2106 " Default value, may be changed later: | |
2107 let format = exists("g:tex_flavor") ? g:tex_flavor : 'plain' | |
2108 " Save position, go to the top of the file, find first non-comment line. | |
2109 let save_cursor = getpos('.') | |
2110 call cursor(1,1) | |
2111 let firstNC = search('^\s*[^[:space:]%]', 'c', 1000) | |
2112 if firstNC " Check the next thousand lines for a LaTeX or ConTeXt keyword. | |
2113 let lpat = 'documentclass\>\|usepackage\>\|begin{\|newcommand\>\|renewcommand\>' | |
2114 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\>' | |
2115 let kwline = search('^\s*\\\%(' . lpat . '\)\|^\s*\\\(' . cpat . '\)', | |
2116 \ 'cnp', firstNC + 1000) | |
2117 if kwline == 1 " lpat matched | |
2118 let format = 'latex' | |
2119 elseif kwline == 2 " cpat matched | |
2120 let format = 'context' | |
2121 endif " If neither matched, keep default set above. | |
2122 " let lline = search('^\s*\\\%(' . lpat . '\)', 'cn', firstNC + 1000) | |
2123 " let cline = search('^\s*\\\%(' . cpat . '\)', 'cn', firstNC + 1000) | |
2124 " if cline > 0 | |
2125 " let format = 'context' | |
2126 " endif | |
2127 " if lline > 0 && (cline == 0 || cline > lline) | |
2128 " let format = 'tex' | |
2129 " endif | |
2130 endif " firstNC | |
2131 call setpos('.', save_cursor) | |
2132 endif " firstline =~ '^%&\s*\a\+' | |
694 | 2133 |
800 | 2134 " Translation from formats to file types. TODO: add AMSTeX, RevTex, others? |
2135 if format == 'plain' | |
2136 setf plaintex | |
2137 elseif format == 'context' | |
694 | 2138 setf context |
800 | 2139 else " probably LaTeX |
694 | 2140 setf tex |
2141 endif | |
800 | 2142 return |
1219 | 2143 endfunc |
378 | 2144 |
1648 | 2145 " ConTeXt |
2146 au BufNewFile,BufRead tex/context/*/*.tex,*.mkii,*.mkiv setf context | |
7 | 2147 |
2148 " Texinfo | |
2149 au BufNewFile,BufRead *.texinfo,*.texi,*.txi setf texinfo | |
2150 | |
2151 " TeX configuration | |
2152 au BufNewFile,BufRead texmf.cnf setf texmf | |
2153 | |
2154 " Tidy config | |
2155 au BufNewFile,BufRead .tidyrc,tidyrc setf tidy | |
2156 | |
2157 " TF mud client | |
2158 au BufNewFile,BufRead *.tf,.tfrc,tfrc setf tf | |
2159 | |
33 | 2160 " TPP - Text Presentation Program |
2161 au BufNewFile,BufReadPost *.tpp setf tpp | |
2162 | |
2725 | 2163 " Treetop |
2164 au BufRead,BufNewFile *.treetop setf treetop | |
2165 | |
555 | 2166 " Trustees |
2167 au BufNewFile,BufRead trustees.conf setf trustees | |
2168 | |
7 | 2169 " TSS - Geometry |
2170 au BufNewFile,BufReadPost *.tssgm setf tssgm | |
2171 | |
2172 " TSS - Optics | |
2173 au BufNewFile,BufReadPost *.tssop setf tssop | |
2174 | |
2175 " TSS - Command Line (temporary) | |
2176 au BufNewFile,BufReadPost *.tsscl setf tsscl | |
2177 | |
3456 | 2178 " TWIG files |
2179 au BufNewFile,BufReadPost *.twig setf twig | |
2180 | |
7 | 2181 " Motif UIT/UIL files |
2182 au BufNewFile,BufRead *.uit,*.uil setf uil | |
2183 | |
389 | 2184 " Udev conf |
2751 | 2185 au BufNewFile,BufRead */etc/udev/udev.conf setf udevconf |
389 | 2186 |
2187 " Udev permissions | |
2751 | 2188 au BufNewFile,BufRead */etc/udev/permissions.d/*.permissions setf udevperm |
389 | 2189 " |
2190 " Udev symlinks config | |
2751 | 2191 au BufNewFile,BufRead */etc/udev/cdsymlinks.conf setf sh |
389 | 2192 |
7 | 2193 " UnrealScript |
2194 au BufNewFile,BufRead *.uc setf uc | |
2195 | |
375 | 2196 " Updatedb |
2751 | 2197 au BufNewFile,BufRead */etc/updatedb.conf setf updatedb |
375 | 2198 |
2725 | 2199 " Upstart (init(8)) config files |
4186 | 2200 au BufNewFile,BufRead */usr/share/upstart/*.conf setf upstart |
2201 au BufNewFile,BufRead */usr/share/upstart/*.override setf upstart | |
2202 au BufNewFile,BufRead */etc/init/*.conf,*/etc/init/*.override setf upstart | |
2203 au BufNewFile,BufRead */.init/*.conf,*/.init/*.override setf upstart | |
2204 au BufNewFile,BufRead */.config/upstart/*.conf setf upstart | |
2205 au BufNewFile,BufRead */.config/upstart/*.override setf upstart | |
2725 | 2206 |
836 | 2207 " Vera |
2208 au BufNewFile,BufRead *.vr,*.vri,*.vrh setf vera | |
2209 | |
7 | 2210 " Verilog HDL |
2211 au BufNewFile,BufRead *.v setf verilog | |
2212 | |
481 | 2213 " Verilog-AMS HDL |
2214 au BufNewFile,BufRead *.va,*.vams setf verilogams | |
2215 | |
7 | 2216 " VHDL |
216 | 2217 au BufNewFile,BufRead *.hdl,*.vhd,*.vhdl,*.vbe,*.vst setf vhdl |
375 | 2218 au BufNewFile,BufRead *.vhdl_[0-9]* call s:StarSetf('vhdl') |
7 | 2219 |
2220 " Vim script | |
794 | 2221 au BufNewFile,BufRead *.vim,*.vba,.exrc,_exrc setf vim |
7 | 2222 |
2223 " Viminfo file | |
2224 au BufNewFile,BufRead .viminfo,_viminfo setf viminfo | |
2225 | |
2034 | 2226 " Virata Config Script File or Drupal module |
2227 au BufRead,BufNewFile *.hw,*.module,*.pkg | |
2228 \ if getline(1) =~ '<?php' | | |
2229 \ setf php | | |
2230 \ else | | |
2231 \ setf virata | | |
2232 \ endif | |
7 | 2233 |
2234 " Visual Basic (also uses *.bas) or FORM | |
216 | 2235 au BufNewFile,BufRead *.frm call s:FTVB("form") |
7 | 2236 |
2237 " SaxBasic is close to Visual Basic | |
2238 au BufNewFile,BufRead *.sba setf vb | |
2239 | |
2240 " Vgrindefs file | |
2241 au BufNewFile,BufRead vgrindefs setf vgrindefs | |
2242 | |
2243 " VRML V1.0c | |
2244 au BufNewFile,BufRead *.wrl setf vrml | |
2245 | |
2246 " Webmacro | |
2247 au BufNewFile,BufRead *.wm setf webmacro | |
2248 | |
2249 " Wget config | |
2250 au BufNewFile,BufRead .wgetrc,wgetrc setf wget | |
2251 | |
2252 " Website MetaLanguage | |
2253 au BufNewFile,BufRead *.wml setf wml | |
2254 | |
2255 " Winbatch | |
2256 au BufNewFile,BufRead *.wbt setf winbatch | |
2257 | |
753 | 2258 " WSML |
2259 au BufNewFile,BufRead *.wsml setf wsml | |
2260 | |
7 | 2261 " WvDial |
2262 au BufNewFile,BufRead wvdial.conf,.wvdialrc setf wvdial | |
2263 | |
2264 " CVS RC file | |
2265 au BufNewFile,BufRead .cvsrc setf cvsrc | |
2266 | |
2267 " CVS commit file | |
2268 au BufNewFile,BufRead cvs\d\+ setf cvs | |
2269 | |
2270 " WEB (*.web is also used for Winbatch: Guess, based on expecting "%" comment | |
2271 " lines in a WEB file). | |
2272 au BufNewFile,BufRead *.web | |
2273 \ if getline(1)[0].getline(2)[0].getline(3)[0].getline(4)[0].getline(5)[0] =~ "%" | | |
2274 \ setf web | | |
2275 \ else | | |
2276 \ setf winbatch | | |
2277 \ endif | |
2278 | |
2279 " Windows Scripting Host and Windows Script Component | |
2280 au BufNewFile,BufRead *.ws[fc] setf wsh | |
2281 | |
1125 | 2282 " XHTML |
2283 au BufNewFile,BufRead *.xhtml,*.xht setf xhtml | |
2284 | |
7 | 2285 " X Pixmap (dynamically sets colors, use BufEnter to make it work better) |
2286 au BufEnter *.xpm | |
2287 \ if getline(1) =~ "XPM2" | | |
2288 \ setf xpm2 | | |
2289 \ else | | |
2290 \ setf xpm | | |
2291 \ endif | |
2292 au BufEnter *.xpm2 setf xpm2 | |
2293 | |
2294 " XFree86 config | |
2295 au BufNewFile,BufRead XF86Config | |
2296 \ if getline(1) =~ '\<XConfigurator\>' | | |
2788 | 2297 \ let b:xf86conf_xfree86_version = 3 | |
7 | 2298 \ endif | |
2299 \ setf xf86conf | |
2751 | 2300 au BufNewFile,BufRead */xorg.conf.d/*.conf |
2301 \ let b:xf86conf_xfree86_version = 4 | | |
2302 \ setf xf86conf | |
7 | 2303 |
2304 " Xorg config | |
2751 | 2305 au BufNewFile,BufRead xorg.conf,xorg.conf-4 let b:xf86conf_xfree86_version = 4 | setf xf86conf |
7 | 2306 |
375 | 2307 " Xinetd conf |
2751 | 2308 au BufNewFile,BufRead */etc/xinetd.conf setf xinetd |
375 | 2309 |
7 | 2310 " XS Perl extension interface language |
2311 au BufNewFile,BufRead *.xs setf xs | |
2312 | |
2313 " X resources file | |
2314 au BufNewFile,BufRead .Xdefaults,.Xpdefaults,.Xresources,xdm-config,*.ad setf xdefaults | |
2315 | |
2316 " Xmath | |
2317 au BufNewFile,BufRead *.msc,*.msf setf xmath | |
2318 au BufNewFile,BufRead *.ms | |
216 | 2319 \ if !s:FTnroff() | setf xmath | endif |
7 | 2320 |
1648 | 2321 " XML specific variants: docbk and xbl |
2322 au BufNewFile,BufRead *.xml call s:FTxml() | |
2323 | |
2324 func! s:FTxml() | |
2325 let n = 1 | |
2326 while n < 100 && n < line("$") | |
2327 let line = getline(n) | |
3967 | 2328 " DocBook 4 or DocBook 5. |
2329 let is_docbook4 = line =~ '<!DOCTYPE.*DocBook' | |
2330 let is_docbook5 = line =~ ' xmlns="http://docbook.org/ns/docbook"' | |
2331 if is_docbook4 || is_docbook5 | |
1648 | 2332 let b:docbk_type = "xml" |
3967 | 2333 if is_docbook5 |
2334 let b:docbk_ver = 5 | |
2335 else | |
2336 let b:docbk_ver = 4 | |
2337 endif | |
1648 | 2338 setf docbk |
2339 return | |
2340 endif | |
2341 if line =~ 'xmlns:xbl="http://www.mozilla.org/xbl"' | |
2342 setf xbl | |
2343 return | |
2344 endif | |
2345 let n += 1 | |
2346 endwhile | |
2347 setf xml | |
2348 endfunc | |
7 | 2349 |
2350 " XMI (holding UML models) is also XML | |
2351 au BufNewFile,BufRead *.xmi setf xml | |
2352 | |
2353 " CSPROJ files are Visual Studio.NET's XML-based project config files | |
2354 au BufNewFile,BufRead *.csproj,*.csproj.user setf xml | |
2355 | |
2356 " Qt Linguist translation source and Qt User Interface Files are XML | |
2357 au BufNewFile,BufRead *.ts,*.ui setf xml | |
2358 | |
1125 | 2359 " TPM's are RDF-based descriptions of TeX packages (Nikolai Weibull) |
2360 au BufNewFile,BufRead *.tpm setf xml | |
2361 | |
389 | 2362 " Xdg menus |
2751 | 2363 au BufNewFile,BufRead */etc/xdg/menus/*.menu setf xml |
389 | 2364 |
1648 | 2365 " ATI graphics driver configuration |
2366 au BufNewFile,BufRead fglrxrc setf xml | |
2367 | |
2368 " XLIFF (XML Localisation Interchange File Format) is also XML | |
2369 au BufNewFile,BufRead *.xlf setf xml | |
2370 au BufNewFile,BufRead *.xliff setf xml | |
2371 | |
3410
94601b379f38
Updated runtime files. Add Dutch translations.
Bram Moolenaar <bram@vim.org>
parents:
3356
diff
changeset
|
2372 " XML User Interface Language |
94601b379f38
Updated runtime files. Add Dutch translations.
Bram Moolenaar <bram@vim.org>
parents:
3356
diff
changeset
|
2373 au BufNewFile,BufRead *.xul setf xml |
94601b379f38
Updated runtime files. Add Dutch translations.
Bram Moolenaar <bram@vim.org>
parents:
3356
diff
changeset
|
2374 |
1648 | 2375 " X11 xmodmap (also see below) |
2376 au BufNewFile,BufRead *Xmodmap setf xmodmap | |
2377 | |
419 | 2378 " Xquery |
2379 au BufNewFile,BufRead *.xq,*.xql,*.xqm,*.xquery,*.xqy setf xquery | |
2380 | |
7 | 2381 " XSD |
2382 au BufNewFile,BufRead *.xsd setf xsd | |
2383 | |
2384 " Xslt | |
2385 au BufNewFile,BufRead *.xsl,*.xslt setf xslt | |
2386 | |
2387 " Yacc | |
375 | 2388 au BufNewFile,BufRead *.yy setf yacc |
2389 | |
2390 " Yacc or racc | |
2391 au BufNewFile,BufRead *.y call s:FTy() | |
2392 | |
1219 | 2393 func! s:FTy() |
375 | 2394 let n = 1 |
484 | 2395 while n < 100 && n < line("$") |
2396 let line = getline(n) | |
2397 if line =~ '^\s*%' | |
2398 setf yacc | |
2399 return | |
2400 endif | |
482 | 2401 if getline(n) =~ '^\s*\(#\|class\>\)' && getline(n) !~ '^\s*#\s*include' |
375 | 2402 setf racc |
2403 return | |
2404 endif | |
2405 let n = n + 1 | |
2406 endwhile | |
2407 setf yacc | |
1219 | 2408 endfunc |
375 | 2409 |
7 | 2410 |
2411 " Yaml | |
2412 au BufNewFile,BufRead *.yaml,*.yml setf yaml | |
2413 | |
3082 | 2414 " yum conf (close enough to dosini) |
2415 au BufNewFile,BufRead */etc/yum.conf setf dosini | |
2416 | |
3513 | 2417 " Zimbu |
2418 au BufNewFile,BufRead *.zu setf zimbu | |
2419 | |
809 | 2420 " Zope |
2421 " dtml (zope dynamic template markup language), pt (zope page template), | |
2422 " cpt (zope form controller page template) | |
826 | 2423 au BufNewFile,BufRead *.dtml,*.pt,*.cpt call s:FThtml() |
809 | 2424 " zsql (zope sql method) |
2425 au BufNewFile,BufRead *.zsql call s:SQL() | |
2426 | |
7 | 2427 " Z80 assembler asz80 |
2428 au BufNewFile,BufRead *.z8a setf z8a | |
2429 | |
2430 augroup END | |
2431 | |
2432 | |
2433 " Source the user-specified filetype file, for backwards compatibility with | |
2434 " Vim 5.x. | |
216 | 2435 if exists("myfiletypefile") && filereadable(expand(myfiletypefile)) |
7 | 2436 execute "source " . myfiletypefile |
2437 endif | |
2438 | |
2439 | |
2440 " Check for "*" after loading myfiletypefile, so that scripts.vim is only used | |
2441 " when there are no matching file name extensions. | |
2442 " Don't do this for compressed files. | |
2443 augroup filetypedetect | |
2444 au BufNewFile,BufRead * | |
2445 \ if !did_filetype() && expand("<amatch>") !~ g:ft_ignore_pat | |
2446 \ | runtime! scripts.vim | endif | |
2447 au StdinReadPost * if !did_filetype() | runtime! scripts.vim | endif | |
2448 | |
2449 | |
2450 " Extra checks for when no filetype has been detected now. Mostly used for | |
2451 " patterns that end in "*". E.g., "zsh*" matches "zsh.vim", but that's a Vim | |
2452 " script file. | |
216 | 2453 " Most of these should call s:StarSetf() to avoid names ending in .gz and the |
2454 " like are used. | |
7 | 2455 |
2751 | 2456 " More Apache config files |
2457 au BufNewFile,BufRead access.conf*,apache.conf*,apache2.conf*,httpd.conf*,srm.conf* call s:StarSetf('apache') | |
2458 au BufNewFile,BufRead */etc/apache2/*.conf*,*/etc/apache2/conf.*/*,*/etc/apache2/mods-*/*,*/etc/apache2/sites-*/*,*/etc/httpd/conf.d/*.conf* call s:StarSetf('apache') | |
1668 | 2459 |
531 | 2460 " Asterisk config file |
856 | 2461 au BufNewFile,BufRead *asterisk/*.conf* call s:StarSetf('asterisk') |
794 | 2462 au BufNewFile,BufRead *asterisk*/*voicemail.conf* call s:StarSetf('asteriskvm') |
531 | 2463 |
1125 | 2464 " Bazaar version control |
2465 au BufNewFile,BufRead bzr_log.* setf bzr | |
2466 | |
7 | 2467 " BIND zone |
805 | 2468 au BufNewFile,BufRead */named/db.*,*/bind/db.* call s:StarSetf('bindzone') |
7 | 2469 |
2788 | 2470 " Calendar |
2471 au BufNewFile,BufRead */.calendar/*, | |
2472 \*/share/calendar/*/calendar.*,*/share/calendar/calendar.* | |
2473 \ call s:StarSetf('calendar') | |
2474 | |
7 | 2475 " Changelog |
216 | 2476 au BufNewFile,BufRead [cC]hange[lL]og* |
2477 \ if getline(1) =~ '; urgency=' | |
2478 \| call s:StarSetf('debchangelog') | |
2479 \|else | |
2480 \| call s:StarSetf('changelog') | |
2481 \|endif | |
7 | 2482 |
2483 " Crontab | |
2751 | 2484 au BufNewFile,BufRead crontab,crontab.*,*/etc/cron.d/* call s:StarSetf('crontab') |
816 | 2485 |
2788 | 2486 " dnsmasq(8) configuration |
2487 au BufNewFile,BufRead */etc/dnsmasq.d/* call s:StarSetf('dnsmasq') | |
2488 | |
7 | 2489 " Dracula |
216 | 2490 au BufNewFile,BufRead drac.* call s:StarSetf('dracula') |
7 | 2491 |
2492 " Fvwm | |
1125 | 2493 au BufNewFile,BufRead */.fvwm/* call s:StarSetf('fvwm') |
7 | 2494 au BufNewFile,BufRead *fvwmrc*,*fvwm95*.hook |
216 | 2495 \ let b:fvwm_version = 1 | call s:StarSetf('fvwm') |
7 | 2496 au BufNewFile,BufRead *fvwm2rc* |
216 | 2497 \ if expand("<afile>:e") == "m4" |
2498 \| call s:StarSetf('fvwm2m4') | |
2499 \|else | |
2500 \| let b:fvwm_version = 2 | call s:StarSetf('fvwm') | |
2501 \|endif | |
7 | 2502 |
2034 | 2503 " Gedcom |
2788 | 2504 au BufNewFile,BufRead */tmp/lltmp* call s:StarSetf('gedcom') |
2034 | 2505 |
7 | 2506 " GTK RC |
216 | 2507 au BufNewFile,BufRead .gtkrc*,gtkrc* call s:StarSetf('gtkrc') |
7 | 2508 |
2509 " Jam | |
216 | 2510 au BufNewFile,BufRead Prl*.*,JAM*.* call s:StarSetf('jam') |
7 | 2511 |
2512 " Jargon | |
2513 au! BufNewFile,BufRead *jarg* | |
216 | 2514 \ if getline(1).getline(2).getline(3).getline(4).getline(5) =~? 'THIS IS THE JARGON FILE' |
2515 \| call s:StarSetf('jargon') | |
2516 \|endif | |
7 | 2517 |
837 | 2518 " Kconfig |
2519 au BufNewFile,BufRead Kconfig.* call s:StarSetf('kconfig') | |
2520 | |
2788 | 2521 " Lilo: Linux loader |
2522 au BufNewFile,BufRead lilo.conf* call s:StarSetf('lilo') | |
2523 | |
2434
86532ee3ea41
Updated runtime files. Add logcheck filetype plugin. (James Vega)
Bram Moolenaar <bram@vim.org>
parents:
2415
diff
changeset
|
2524 " Logcheck |
2751 | 2525 au BufNewFile,BufRead */etc/logcheck/*.d*/* call s:StarSetf('logcheck') |
2434
86532ee3ea41
Updated runtime files. Add logcheck filetype plugin. (James Vega)
Bram Moolenaar <bram@vim.org>
parents:
2415
diff
changeset
|
2526 |
7 | 2527 " Makefile |
216 | 2528 au BufNewFile,BufRead [mM]akefile* call s:StarSetf('make') |
7 | 2529 |
1648 | 2530 " Ruby Makefile |
2531 au BufNewFile,BufRead [rR]akefile* call s:StarSetf('ruby') | |
2532 | |
2533 " Mail (also matches muttrc.vim, so this is below the other checks) | |
2534 au BufNewFile,BufRead mutt[[:alnum:]._-]\{6\} setf mail | |
2535 | |
389 | 2536 " Modconf |
2788 | 2537 au BufNewFile,BufRead */etc/modutils/* |
2538 \ if executable(expand("<afile>")) != 1 | |
2539 \| call s:StarSetf('modconf') | |
2540 \|endif | |
2751 | 2541 au BufNewFile,BufRead */etc/modprobe.* call s:StarSetf('modconf') |
389 | 2542 |
7 | 2543 " Mutt setup file |
1648 | 2544 au BufNewFile,BufRead .mutt{ng,}rc*,*/.mutt{ng,}/mutt{ng,}rc* call s:StarSetf('muttrc') |
484 | 2545 au BufNewFile,BufRead mutt{ng,}rc*,Mutt{ng,}rc* call s:StarSetf('muttrc') |
7 | 2546 |
2547 " Nroff macros | |
216 | 2548 au BufNewFile,BufRead tmac.* call s:StarSetf('nroff') |
7 | 2549 |
375 | 2550 " Pam conf |
2751 | 2551 au BufNewFile,BufRead */etc/pam.d/* call s:StarSetf('pamconf') |
375 | 2552 |
7 | 2553 " Printcap and Termcap |
2554 au BufNewFile,BufRead *printcap* | |
216 | 2555 \ if !did_filetype() |
2556 \| let b:ptcap_type = "print" | call s:StarSetf('ptcap') | |
2557 \|endif | |
7 | 2558 au BufNewFile,BufRead *termcap* |
216 | 2559 \ if !did_filetype() |
2560 \| let b:ptcap_type = "term" | call s:StarSetf('ptcap') | |
2561 \|endif | |
7 | 2562 |
2788 | 2563 " Remind |
2564 au BufNewFile,BufRead .reminders* call s:StarSetf('remind') | |
2565 | |
7 | 2566 " Vim script |
216 | 2567 au BufNewFile,BufRead *vimrc* call s:StarSetf('vim') |
7 | 2568 |
2569 " Subversion commit file | |
45 | 2570 au BufNewFile,BufRead svn-commit*.tmp setf svn |
7 | 2571 |
2572 " X resources file | |
216 | 2573 au BufNewFile,BufRead Xresources*,*/app-defaults/*,*/Xresources/* call s:StarSetf('xdefaults') |
7 | 2574 |
2575 " XFree86 config | |
2576 au BufNewFile,BufRead XF86Config-4* | |
2751 | 2577 \ let b:xf86conf_xfree86_version = 4 | call s:StarSetf('xf86conf') |
7 | 2578 au BufNewFile,BufRead XF86Config* |
216 | 2579 \ if getline(1) =~ '\<XConfigurator\>' |
2751 | 2580 \| let b:xf86conf_xfree86_version = 3 |
216 | 2581 \|endif |
2582 \|call s:StarSetf('xf86conf') | |
7 | 2583 |
2584 " X11 xmodmap | |
216 | 2585 au BufNewFile,BufRead *xmodmap* call s:StarSetf('xmodmap') |
7 | 2586 |
375 | 2587 " Xinetd conf |
2751 | 2588 au BufNewFile,BufRead */etc/xinetd.d/* call s:StarSetf('xinetd') |
375 | 2589 |
3082 | 2590 " yum conf (close enough to dosini) |
2591 au BufNewFile,BufRead */etc/yum.repos.d/* call s:StarSetf('dosini') | |
2592 | |
7 | 2593 " Z-Shell script |
216 | 2594 au BufNewFile,BufRead zsh*,zlog* call s:StarSetf('zsh') |
7 | 2595 |
2596 | |
3237 | 2597 " Plain text files, needs to be far down to not override others. This avoids |
2598 " the "conf" type being used if there is a line starting with '#'. | |
2599 au BufNewFile,BufRead *.txt,*.text setf text | |
2600 | |
2013 | 2601 |
2602 " Use the filetype detect plugins. They may overrule any of the previously | |
2603 " detected filetypes. | |
2604 runtime! ftdetect/*.vim | |
2605 | |
3326 | 2606 " NOTE: The above command could have ended the filetypedetect autocmd group |
3356 | 2607 " and started another one. Let's make sure it has ended to get to a consistent |
3326 | 2608 " state. |
2609 augroup END | |
2013 | 2610 |
7 | 2611 " Generic configuration file (check this last, it's just guessing!) |
3326 | 2612 au filetypedetect BufNewFile,BufRead,StdinReadPost * |
7 | 2613 \ if !did_filetype() && expand("<amatch>") !~ g:ft_ignore_pat |
2614 \ && (getline(1) =~ '^#' || getline(2) =~ '^#' || getline(3) =~ '^#' | |
2615 \ || getline(4) =~ '^#' || getline(5) =~ '^#') | | |
2616 \ setf conf | | |
2617 \ endif | |
2618 | |
2619 | |
2620 " If the GUI is already running, may still need to install the Syntax menu. | |
2621 " Don't do it when the 'M' flag is included in 'guioptions'. | |
2622 if has("menu") && has("gui_running") | |
2623 \ && !exists("did_install_syntax_menu") && &guioptions !~# "M" | |
2624 source <sfile>:p:h/menu.vim | |
2625 endif | |
2626 | |
1219 | 2627 " Function called for testing all functions defined here. These are |
2628 " script-local, thus need to be executed here. | |
2629 " Returns a string with error messages (hopefully empty). | |
2630 func! TestFiletypeFuncs(testlist) | |
2631 let output = '' | |
2632 for f in a:testlist | |
2633 try | |
2634 exe f | |
2635 catch | |
2636 let output = output . "\n" . f . ": " . v:exception | |
2637 endtry | |
2638 endfor | |
2639 return output | |
2640 endfunc | |
2641 | |
7 | 2642 " Restore 'cpoptions' |
2643 let &cpo = s:cpo_save | |
2644 unlet s:cpo_save |