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