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