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