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