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