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