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