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