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