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