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