Mercurial > vim
annotate runtime/filetype.vim @ 10051:46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Aug 31 22:22:10 2016 +0200
Updated runtime files. Remove HiLink commands.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Wed, 31 Aug 2016 22:30:08 +0200 |
parents | 03fa8a51e9dc |
children | b7da8d4c594c |
rev | line source |
---|---|
7 | 1 " Vim support file to detect file types |
2 " | |
3 " Maintainer: Bram Moolenaar <Bram@vim.org> | |
9975
03fa8a51e9dc
commit https://github.com/vim/vim/commit/e4a3bcf28d92d0bde9ca227ccb40d401038185e5
Christian Brabandt <cb@256bit.org>
parents:
9908
diff
changeset
|
4 " Last Change: 2016 Aug 26 |
7 | 5 |
6 " Listen very carefully, I will say this only once | |
7 if exists("did_load_filetypes") | |
8 finish | |
9 endif | |
10 let did_load_filetypes = 1 | |
11 | |
12 " Line continuation is used here, remove 'C' from 'cpoptions' | |
13 let s:cpo_save = &cpo | |
14 set cpo&vim | |
15 | |
16 augroup filetypedetect | |
17 | |
18 " Ignored extensions | |
1586 | 19 if exists("*fnameescape") |
9041
34c45ee4210d
commit https://github.com/vim/vim/commit/06481427005a9dae39721087df94855f7d4d1feb
Christian Brabandt <cb@256bit.org>
parents:
7301
diff
changeset
|
20 au BufNewFile,BufRead ?\+.orig,?\+.bak,?\+.old,?\+.new,?\+.dpkg-dist,?\+.dpkg-old,?\+.dpkg-new,?\+.dpkg-bak,?\+.rpmsave,?\+.rpmnew,?\+.pacsave,?\+.pacnew |
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 |
9644
9f7bcc2c3b97
commit https://github.com/vim/vim/commit/6f1d9a096bf22d50c727dca73abbfb8e3ff55176
Christian Brabandt <cb@256bit.org>
parents:
9555
diff
changeset
|
537 au BufNewFile,BufRead Dockerfile,*.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*$" | |
9975
03fa8a51e9dc
commit https://github.com/vim/vim/commit/e4a3bcf28d92d0bde9ca227ccb40d401038185e5
Christian Brabandt <cb@256bit.org>
parents:
9908
diff
changeset
|
695 setf specman |
03fa8a51e9dc
commit https://github.com/vim/vim/commit/e4a3bcf28d92d0bde9ca227ccb40d401038185e5
Christian Brabandt <cb@256bit.org>
parents:
9908
diff
changeset
|
696 return |
5697 | 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 |
9908
2b6654519a7c
commit https://github.com/vim/vim/commit/7571d55f7dcc009a375b2124cce2c8b21f361234
Christian Brabandt <cb@256bit.org>
parents:
9644
diff
changeset
|
782 au BufNewFile,BufRead COMMIT_EDITMSG,MERGE_MSG,TAG_EDITMSG setf gitcommit |
2788 | 783 au BufNewFile,BufRead *.git/config,.gitconfig,.gitmodules setf gitconfig |
5277 | 784 au BufNewFile,BufRead *.git/modules/*/config setf gitconfig |
4681
2eb30f341e8d
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
4437
diff
changeset
|
785 au BufNewFile,BufRead */.config/git/config setf gitconfig |
6336 | 786 if !empty($XDG_CONFIG_HOME) |
787 au BufNewFile,BufRead $XDG_CONFIG_HOME/git/config setf gitconfig | |
788 endif | |
4229 | 789 au BufNewFile,BufRead git-rebase-todo setf gitrebase |
2788 | 790 au BufNewFile,BufRead .msg.[0-9]* |
1648 | 791 \ if getline(1) =~ '^From.*# This line is ignored.$' | |
792 \ setf gitsendemail | | |
793 \ endif | |
5277 | 794 au BufNewFile,BufRead *.git/* |
1648 | 795 \ if getline(1) =~ '^\x\{40\}\>\|^ref: ' | |
796 \ setf git | | |
797 \ endif | |
798 | |
7 | 799 " Gkrellmrc |
800 au BufNewFile,BufRead gkrellmrc,gkrellmrc_? setf gkrellmrc | |
801 | |
802 " GP scripts (2.0 and onward) | |
827 | 803 au BufNewFile,BufRead *.gp,.gprc setf gp |
7 | 804 |
805 " GPG | |
806 au BufNewFile,BufRead */.gnupg/options setf gpg | |
807 au BufNewFile,BufRead */.gnupg/gpg.conf setf gpg | |
5277 | 808 au BufNewFile,BufRead */usr/*/gnupg/options.skel setf gpg |
2788 | 809 |
810 " gnash(1) configuration files | |
811 au BufNewFile,BufRead gnashrc,.gnashrc,gnashpluginrc,.gnashpluginrc setf gnash | |
7 | 812 |
3153 | 813 " Gitolite |
814 au BufNewFile,BufRead gitolite.conf setf gitolite | |
815 au BufNewFile,BufRead */gitolite-admin/conf/* call s:StarSetf('gitolite') | |
4229 | 816 au BufNewFile,BufRead {,.}gitolite.rc,example.gitolite.rc setf perl |
3153 | 817 |
7 | 818 " Gnuplot scripts |
819 au BufNewFile,BufRead *.gpi setf gnuplot | |
820 | |
6153 | 821 " Go (Google) |
822 au BufNewFile,BufRead *.go setf go | |
823 | |
7 | 824 " GrADS scripts |
825 au BufNewFile,BufRead *.gs setf grads | |
826 | |
625 | 827 " Gretl |
828 au BufNewFile,BufRead *.gretl setf gretl | |
829 | |
7 | 830 " Groovy |
7147
c590de398af9
commit https://github.com/vim/vim/commit/ca63501fbcd1cf9c8aa9ff12c093c95b62a89ed7
Christian Brabandt <cb@256bit.org>
parents:
7094
diff
changeset
|
831 au BufNewFile,BufRead *.gradle,*.groovy setf groovy |
7 | 832 |
833 " GNU Server Pages | |
834 au BufNewFile,BufRead *.gsp setf gsp | |
835 | |
389 | 836 " Group file |
2751 | 837 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 | 838 |
7 | 839 " GTK RC |
840 au BufNewFile,BufRead .gtkrc,gtkrc setf gtkrc | |
841 | |
1668 | 842 " Haml |
843 au BufNewFile,BufRead *.haml setf haml | |
844 | |
1125 | 845 " Hamster Classic | Playground files |
846 au BufNewFile,BufRead *.hsc,*.hsm setf hamster | |
847 | |
7 | 848 " Haskell |
2725 | 849 au BufNewFile,BufRead *.hs,*.hs-boot setf haskell |
7 | 850 au BufNewFile,BufRead *.lhs setf lhaskell |
851 au BufNewFile,BufRead *.chs setf chaskell | |
852 | |
1648 | 853 " Haste |
854 au BufNewFile,BufRead *.ht setf haste | |
1668 | 855 au BufNewFile,BufRead *.htpp setf hastepreproc |
1648 | 856 |
7 | 857 " Hercules |
858 au BufNewFile,BufRead *.vc,*.ev,*.rs,*.sum,*.errsum setf hercules | |
859 | |
860 " HEX (Intel) | |
861 au BufNewFile,BufRead *.hex,*.h32 setf hex | |
862 | |
863 " Tilde (must be before HTML) | |
864 au BufNewFile,BufRead *.t.html setf tilde | |
865 | |
497 | 866 " HTML (.shtml and .stm for server side) |
867 au BufNewFile,BufRead *.html,*.htm,*.shtml,*.stm call s:FThtml() | |
7 | 868 |
798 | 869 " Distinguish between HTML, XHTML and Django |
1219 | 870 func! s:FThtml() |
7 | 871 let n = 1 |
872 while n < 10 && n < line("$") | |
873 if getline(n) =~ '\<DTD\s\+XHTML\s' | |
874 setf xhtml | |
875 return | |
876 endif | |
7094
66137191901a
commit https://github.com/vim/vim/commit/d8986fd91494642b3bab305406aa55268498f49c
Christian Brabandt <cb@256bit.org>
parents:
7013
diff
changeset
|
877 if getline(n) =~ '{%\s*\(extends\|block\|load\)\>\|{#\s\+' |
798 | 878 setf htmldjango |
879 return | |
880 endif | |
7 | 881 let n = n + 1 |
882 endwhile | |
883 setf html | |
1219 | 884 endfunc |
7 | 885 |
497 | 886 " HTML with Ruby - eRuby |
1219 | 887 au BufNewFile,BufRead *.erb,*.rhtml setf eruby |
7 | 888 |
889 " HTML with M4 | |
890 au BufNewFile,BufRead *.html.m4 setf htmlm4 | |
891 | |
892 " HTML Cheetah template | |
893 au BufNewFile,BufRead *.tmpl setf htmlcheetah | |
894 | |
1648 | 895 " Host config |
2751 | 896 au BufNewFile,BufRead */etc/host.conf setf hostconf |
1648 | 897 |
1676 | 898 " Hosts access |
2751 | 899 au BufNewFile,BufRead */etc/hosts.allow,*/etc/hosts.deny setf hostsaccess |
1676 | 900 |
7 | 901 " Hyper Builder |
902 au BufNewFile,BufRead *.hb setf hb | |
903 | |
4869 | 904 " Httest |
905 au BufNewFile,BufRead *.htt,*.htb setf httest | |
906 | |
7 | 907 " Icon |
908 au BufNewFile,BufRead *.icn setf icon | |
909 | |
910 " IDL (Interface Description Language) | |
216 | 911 au BufNewFile,BufRead *.idl call s:FTidl() |
7 | 912 |
913 " Distinguish between standard IDL and MS-IDL | |
1219 | 914 func! s:FTidl() |
7 | 915 let n = 1 |
916 while n < 50 && n < line("$") | |
917 if getline(n) =~ '^\s*import\s\+"\(unknwn\|objidl\)\.idl"' | |
918 setf msidl | |
919 return | |
920 endif | |
921 let n = n + 1 | |
922 endwhile | |
923 setf idl | |
1219 | 924 endfunc |
7 | 925 |
926 " Microsoft IDL (Interface Description Language) Also *.idl | |
927 " MOF = WMI (Windows Management Instrumentation) Managed Object Format | |
928 au BufNewFile,BufRead *.odl,*.mof setf msidl | |
929 | |
930 " Icewm menu | |
931 au BufNewFile,BufRead */.icewm/menu setf icemenu | |
932 | |
1219 | 933 " Indent profile (must come before IDL *.pro!) |
934 au BufNewFile,BufRead .indent.pro setf indent | |
935 au BufNewFile,BufRead indent.pro call s:ProtoCheck('indent') | |
936 | |
7 | 937 " IDL (Interactive Data Language) |
1219 | 938 au BufNewFile,BufRead *.pro call s:ProtoCheck('idlang') |
939 | |
940 " Distinguish between "default" and Cproto prototype file. */ | |
941 func! s:ProtoCheck(default) | |
942 " Cproto files have a comment in the first line and a function prototype in | |
943 " the second line, it always ends in ";". Indent files may also have | |
944 " comments, thus we can't match comments to see the difference. | |
2725 | 945 " IDL files can have a single ';' in the second line, require at least one |
946 " chacter before the ';'. | |
947 if getline(2) =~ '.;$' | |
1219 | 948 setf cpp |
949 else | |
950 exe 'setf ' . a:default | |
951 endif | |
952 endfunc | |
953 | |
7 | 954 |
389 | 955 " Indent RC |
1676 | 956 au BufNewFile,BufRead indentrc setf indent |
389 | 957 |
7 | 958 " Inform |
959 au BufNewFile,BufRead *.inf,*.INF setf inform | |
960 | |
1125 | 961 " Initng |
5277 | 962 au BufNewFile,BufRead */etc/initng/*/*.i,*.ii setf initng |
1125 | 963 |
4992 | 964 " Innovation Data Processing |
5277 | 965 au BufRead,BufNewFile upstream.dat\c,upstream.*.dat\c,*.upstream.dat\c setf upstreamdat |
966 au BufRead,BufNewFile upstream.log\c,upstream.*.log\c,*.upstream.log\c setf upstreamlog | |
967 au BufRead,BufNewFile upstreaminstall.log\c,upstreaminstall.*.log\c,*.upstreaminstall.log\c setf upstreaminstalllog | |
968 au BufRead,BufNewFile usserver.log\c,usserver.*.log\c,*.usserver.log\c setf usserverlog | |
969 au BufRead,BufNewFile usw2kagt.log\c,usw2kagt.*.log\c,*.usw2kagt.log\c setf usw2kagtlog | |
4992 | 970 |
148 | 971 " Ipfilter |
1125 | 972 au BufNewFile,BufRead ipf.conf,ipf6.conf,ipf.rules setf ipfilter |
148 | 973 |
7 | 974 " Informix 4GL (source - canonical, include file, I4GL+M4 preproc.) |
975 au BufNewFile,BufRead *.4gl,*.4gh,*.m4gl setf fgl | |
976 | |
977 " .INI file for MSDOS | |
978 au BufNewFile,BufRead *.ini setf dosini | |
979 | |
980 " SysV Inittab | |
981 au BufNewFile,BufRead inittab setf inittab | |
982 | |
983 " Inno Setup | |
984 au BufNewFile,BufRead *.iss setf iss | |
985 | |
5362
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
5277
diff
changeset
|
986 " J |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
5277
diff
changeset
|
987 au BufNewFile,BufRead *.ijs setf j |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
5277
diff
changeset
|
988 |
7 | 989 " JAL |
990 au BufNewFile,BufRead *.jal,*.JAL setf jal | |
991 | |
992 " Jam | |
993 au BufNewFile,BufRead *.jpl,*.jpr setf jam | |
994 | |
995 " Java | |
996 au BufNewFile,BufRead *.java,*.jav setf java | |
997 | |
998 " JavaCC | |
999 au BufNewFile,BufRead *.jj,*.jjt setf javacc | |
1000 | |
1125 | 1001 " JavaScript, ECMAScript |
6070
32a77cc160d9
Update runtime files. Make matchparen plugin backwards compatible.
Bram Moolenaar <bram@vim.org>
parents:
6051
diff
changeset
|
1002 au BufNewFile,BufRead *.js,*.javascript,*.es,*.jsx setf javascript |
7 | 1003 |
1004 " Java Server Pages | |
1005 au BufNewFile,BufRead *.jsp setf jsp | |
1006 | |
1007 " Java Properties resource file (note: doesn't catch font.properties.pl) | |
216 | 1008 au BufNewFile,BufRead *.properties,*.properties_??,*.properties_??_?? setf jproperties |
1009 au BufNewFile,BufRead *.properties_??_??_* call s:StarSetf('jproperties') | |
7 | 1010 |
1011 " Jess | |
1012 au BufNewFile,BufRead *.clp setf jess | |
1013 | |
1014 " Jgraph | |
1015 au BufNewFile,BufRead *.jgr setf jgraph | |
1016 | |
2908 | 1017 " Jovial |
1018 au BufNewFile,BufRead *.jov,*.j73,*.jovial setf jovial | |
1019 | |
6070
32a77cc160d9
Update runtime files. Make matchparen plugin backwards compatible.
Bram Moolenaar <bram@vim.org>
parents:
6051
diff
changeset
|
1020 " JSON |
9407
619a98a67f67
commit https://github.com/vim/vim/commit/e18dbe865d190e74fb5d43ac8bc6ac22507d0223
Christian Brabandt <cb@256bit.org>
parents:
9041
diff
changeset
|
1021 au BufNewFile,BufRead *.json,*.jsonp,*.webmanifest setf json |
6070
32a77cc160d9
Update runtime files. Make matchparen plugin backwards compatible.
Bram Moolenaar <bram@vim.org>
parents:
6051
diff
changeset
|
1022 |
7 | 1023 " Kixtart |
1024 au BufNewFile,BufRead *.kix setf kix | |
1025 | |
1026 " Kimwitu[++] | |
1027 au BufNewFile,BufRead *.k setf kwt | |
1028 | |
5968 | 1029 " Kivy |
1030 au BufNewFile,BufRead *.kv setf kivy | |
1031 | |
7 | 1032 " KDE script |
1033 au BufNewFile,BufRead *.ks setf kscript | |
1034 | |
826 | 1035 " Kconfig |
1036 au BufNewFile,BufRead Kconfig,Kconfig.debug setf kconfig | |
1037 | |
7 | 1038 " Lace (ISE) |
1039 au BufNewFile,BufRead *.ace,*.ACE setf lace | |
1040 | |
1041 " Latte | |
1042 au BufNewFile,BufRead *.latte,*.lte setf latte | |
1043 | |
375 | 1044 " Limits |
2751 | 1045 au BufNewFile,BufRead */etc/limits,*/etc/*limits.conf,*/etc/*limits.d/*.conf setf limits |
375 | 1046 |
7 | 1047 " LambdaProlog (*.mod too, see Modsim) |
1048 au BufNewFile,BufRead *.sig setf lprolog | |
1049 | |
1050 " LDAP LDIF | |
1051 au BufNewFile,BufRead *.ldif setf ldif | |
1052 | |
375 | 1053 " Ld loader |
1054 au BufNewFile,BufRead *.ld setf ld | |
1055 | |
6476 | 1056 " Less |
1057 au BufNewFile,BufRead *.less setf less | |
1058 | |
7 | 1059 " Lex |
5697 | 1060 au BufNewFile,BufRead *.lex,*.l,*.lxx,*.l++ setf lex |
7 | 1061 |
1062 " Libao | |
2751 | 1063 au BufNewFile,BufRead */etc/libao.conf,*/.libao setf libao |
7 | 1064 |
389 | 1065 " Libsensors |
2751 | 1066 au BufNewFile,BufRead */etc/sensors.conf,*/etc/sensors3.conf setf sensors |
389 | 1067 |
7 | 1068 " LFTP |
1069 au BufNewFile,BufRead lftp.conf,.lftprc,*lftp/rc setf lftp | |
1070 | |
1071 " Lifelines (or Lex for C++!) | |
1072 au BufNewFile,BufRead *.ll setf lifelines | |
1073 | |
1074 " Lilo: Linux loader | |
2788 | 1075 au BufNewFile,BufRead lilo.conf setf lilo |
7 | 1076 |
1077 " Lisp (*.el = ELisp, *.cl = Common Lisp, *.jl = librep Lisp) | |
1078 if has("fname_case") | |
1079 au BufNewFile,BufRead *.lsp,*.lisp,*.el,*.cl,*.jl,*.L,.emacs,.sawfishrc setf lisp | |
1080 else | |
1081 au BufNewFile,BufRead *.lsp,*.lisp,*.el,*.cl,*.jl,.emacs,.sawfishrc setf lisp | |
1082 endif | |
1083 | |
375 | 1084 " SBCL implementation of Common Lisp |
1085 au BufNewFile,BufRead sbclrc,.sbclrc setf lisp | |
1086 | |
2202 | 1087 " Liquid |
1088 au BufNewFile,BufRead *.liquid setf liquid | |
1089 | |
7 | 1090 " Lite |
1091 au BufNewFile,BufRead *.lite,*.lt setf lite | |
1092 | |
1219 | 1093 " LiteStep RC files |
1094 au BufNewFile,BufRead */LiteStep/*/*.rc setf litestep | |
1095 | |
375 | 1096 " Login access |
2751 | 1097 au BufNewFile,BufRead */etc/login.access setf loginaccess |
375 | 1098 |
1099 " Login defs | |
2751 | 1100 au BufNewFile,BufRead */etc/login.defs setf logindefs |
375 | 1101 |
7 | 1102 " Logtalk |
1103 au BufNewFile,BufRead *.lgt setf logtalk | |
1104 | |
1105 " LOTOS | |
1106 au BufNewFile,BufRead *.lot,*.lotos setf lotos | |
1107 | |
1108 " Lout (also: *.lt) | |
1109 au BufNewFile,BufRead *.lou,*.lout setf lout | |
1110 | |
1111 " Lua | |
1112 au BufNewFile,BufRead *.lua setf lua | |
1113 | |
6213 | 1114 " Luarocks |
1115 au BufNewFile,BufRead *.rockspec setf lua | |
1116 | |
1648 | 1117 " Linden Scripting Language (Second Life) |
1118 au BufNewFile,BufRead *.lsl setf lsl | |
1119 | |
7 | 1120 " Lynx style file (or LotusScript!) |
1121 au BufNewFile,BufRead *.lss setf lss | |
1122 | |
1123 " M4 | |
1124 au BufNewFile,BufRead *.m4 | |
1125 \ if expand("<afile>") !~? 'html.m4$\|fvwm2rc' | setf m4 | endif | |
1126 | |
1127 " MaGic Point | |
1128 au BufNewFile,BufRead *.mgp setf mgp | |
1129 | |
1125 | 1130 " Mail (for Elm, trn, mutt, muttng, rn, slrn) |
5277 | 1131 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 | 1132 |
809 | 1133 " Mail aliases |
2751 | 1134 au BufNewFile,BufRead */etc/mail/aliases,*/etc/aliases setf mailaliases |
809 | 1135 |
7 | 1136 " Mailcap configuration file |
1137 au BufNewFile,BufRead .mailcap,mailcap setf mailcap | |
1138 | |
1139 " Makefile | |
1140 au BufNewFile,BufRead *[mM]akefile,*.mk,*.mak,*.dsp setf make | |
1141 | |
1142 " MakeIndex | |
1143 au BufNewFile,BufRead *.ist,*.mst setf ist | |
1144 | |
4119 | 1145 " Mallard |
1146 au BufNewFile,BufRead *.page setf mallard | |
1147 | |
7 | 1148 " Manpage |
1149 au BufNewFile,BufRead *.man setf man | |
1150 | |
389 | 1151 " Man config |
2751 | 1152 au BufNewFile,BufRead */etc/man.conf,man.config setf manconf |
389 | 1153 |
7 | 1154 " Maple V |
1155 au BufNewFile,BufRead *.mv,*.mpl,*.mws setf maple | |
1156 | |
1668 | 1157 " Map (UMN mapserver config file) |
1158 au BufNewFile,BufRead *.map setf map | |
1159 | |
2202 | 1160 " Markdown |
6292
31f7581068a9
Update runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
6213
diff
changeset
|
1161 au BufNewFile,BufRead *.markdown,*.mdown,*.mkd,*.mkdn,*.mdwn,*.md setf markdown |
2202 | 1162 |
7 | 1163 " Mason |
6153 | 1164 au BufNewFile,BufRead *.mason,*.mhtml,*.comp setf mason |
7 | 1165 |
1166 " Matlab or Objective C | |
216 | 1167 au BufNewFile,BufRead *.m call s:FTm() |
7 | 1168 |
1219 | 1169 func! s:FTm() |
7 | 1170 let n = 1 |
1171 while n < 10 | |
1172 let line = getline(n) | |
7013 | 1173 if line =~ '^\s*\(#\s*\(include\|import\)\>\|@import\>\|/\*\|//\)' |
7 | 1174 setf objc |
1175 return | |
1176 endif | |
1177 if line =~ '^\s*%' | |
1178 setf matlab | |
1179 return | |
1180 endif | |
1181 if line =~ '^\s*(\*' | |
1182 setf mma | |
1183 return | |
1184 endif | |
1185 let n = n + 1 | |
1186 endwhile | |
271 | 1187 if exists("g:filetype_m") |
1188 exe "setf " . g:filetype_m | |
1189 else | |
1190 setf matlab | |
1191 endif | |
1219 | 1192 endfunc |
7 | 1193 |
1648 | 1194 " Mathematica notebook |
1195 au BufNewFile,BufRead *.nb setf mma | |
1196 | |
7 | 1197 " Maya Extension Language |
1198 au BufNewFile,BufRead *.mel setf mel | |
1199 | |
3750 | 1200 " Mercurial (hg) commit file |
1201 au BufNewFile,BufRead hg-editor-*.txt setf hgcommit | |
1202 | |
2034 | 1203 " Mercurial config (looks like generic config file) |
1204 au BufNewFile,BufRead *.hgrc,*hgrc setf cfg | |
1205 | |
2709 | 1206 " Messages (logs mostly) |
2788 | 1207 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 | 1208 |
7 | 1209 " Metafont |
1210 au BufNewFile,BufRead *.mf setf mf | |
1211 | |
1212 " MetaPost | |
1213 au BufNewFile,BufRead *.mp setf mp | |
1214 | |
683 | 1215 " MGL |
1216 au BufNewFile,BufRead *.mgl setf mgl | |
1217 | |
5487 | 1218 " MIX - Knuth assembly |
1219 au BufNewFile,BufRead *.mix,*.mixal setf mix | |
1220 | |
7 | 1221 " MMIX or VMS makefile |
216 | 1222 au BufNewFile,BufRead *.mms call s:FTmms() |
7 | 1223 |
1648 | 1224 " Symbian meta-makefile definition (MMP) |
1225 au BufNewFile,BufRead *.mmp setf mmp | |
1226 | |
1219 | 1227 func! s:FTmms() |
7 | 1228 let n = 1 |
1229 while n < 10 | |
1230 let line = getline(n) | |
1231 if line =~ '^\s*\(%\|//\)' || line =~ '^\*' | |
1232 setf mmix | |
1233 return | |
1234 endif | |
1235 if line =~ '^\s*#' | |
1236 setf make | |
1237 return | |
1238 endif | |
1239 let n = n + 1 | |
1240 endwhile | |
1241 setf mmix | |
1219 | 1242 endfunc |
7 | 1243 |
1244 | |
1245 " Modsim III (or LambdaProlog) | |
1246 au BufNewFile,BufRead *.mod | |
1247 \ if getline(1) =~ '\<module\>' | | |
1248 \ setf lprolog | | |
1249 \ else | | |
1250 \ setf modsim3 | | |
1251 \ endif | |
1252 | |
6292
31f7581068a9
Update runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
6213
diff
changeset
|
1253 " Modula 2 (.md removed in favor of Markdown) |
31f7581068a9
Update runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
6213
diff
changeset
|
1254 au BufNewFile,BufRead *.m2,*.DEF,*.MOD,*.mi setf modula2 |
7 | 1255 |
1256 " Modula 3 (.m3, .i3, .mg, .ig) | |
1257 au BufNewFile,BufRead *.[mi][3g] setf modula3 | |
1258 | |
1259 " Monk | |
1260 au BufNewFile,BufRead *.isc,*.monk,*.ssc,*.tsc setf monk | |
1261 | |
1262 " MOO | |
1263 au BufNewFile,BufRead *.moo setf moo | |
1264 | |
1265 " Modconf | |
2788 | 1266 au BufNewFile,BufRead */etc/modules.conf,*/etc/modules,*/etc/conf.modules setf modconf |
7 | 1267 |
1268 " Mplayer config | |
1269 au BufNewFile,BufRead mplayer.conf,*/.mplayer/config setf mplayerconf | |
1270 | |
6697 | 1271 " Motorola S record |
1272 au BufNewFile,BufRead *.s19,*.s28,*.s37,*.mot,*.srec setf srec | |
7 | 1273 |
846 | 1274 " Mrxvtrc |
1275 au BufNewFile,BufRead mrxvtrc,.mrxvtrc setf mrxvtrc | |
1276 | |
7 | 1277 " Msql |
1278 au BufNewFile,BufRead *.msql setf msql | |
1279 | |
1280 " Mysql | |
1281 au BufNewFile,BufRead *.mysql setf mysql | |
1282 | |
2788 | 1283 " Mutt setup files (must be before catch *.rc) |
1284 au BufNewFile,BufRead */etc/Muttrc.d/* call s:StarSetf('muttrc') | |
1285 | |
7 | 1286 " M$ Resource files |
3682 | 1287 au BufNewFile,BufRead *.rc,*.rch setf rc |
7 | 1288 |
12 | 1289 " MuPAD source |
1290 au BufRead,BufNewFile *.mu setf mupad | |
1291 | |
7 | 1292 " Mush |
1293 au BufNewFile,BufRead *.mush setf mush | |
1294 | |
1125 | 1295 " Mutt setup file (also for Muttng) |
1648 | 1296 au BufNewFile,BufRead Mutt{ng,}rc setf muttrc |
7 | 1297 |
389 | 1298 " Nano |
6741 | 1299 au BufNewFile,BufRead */etc/nanorc,*.nanorc setf nanorc |
389 | 1300 |
7 | 1301 " Nastran input/DMAP |
1302 "au BufNewFile,BufRead *.dat setf nastran | |
1303 | |
1304 " Natural | |
1305 au BufNewFile,BufRead *.NS[ACGLMNPS] setf natural | |
1306 | |
39 | 1307 " Netrc |
1308 au BufNewFile,BufRead .netrc setf netrc | |
1309 | |
3256 | 1310 " Ninja file |
1311 au BufNewFile,BufRead *.ninja setf ninja | |
1312 | |
7 | 1313 " Novell netware batch files |
1314 au BufNewFile,BufRead *.ncf setf ncf | |
1315 | |
1316 " Nroff/Troff (*.ms and *.t are checked below) | |
1317 au BufNewFile,BufRead *.me | |
1318 \ if expand("<afile>") != "read.me" && expand("<afile>") != "click.me" | | |
1319 \ setf nroff | | |
1320 \ endif | |
1321 au BufNewFile,BufRead *.tr,*.nr,*.roff,*.tmac,*.mom setf nroff | |
216 | 1322 au BufNewFile,BufRead *.[1-9] call s:FTnroff() |
7 | 1323 |
1324 " This function checks if one of the first five lines start with a dot. In | |
1325 " that case it is probably an nroff file: 'filetype' is set and 1 is returned. | |
1219 | 1326 func! s:FTnroff() |
7 | 1327 if getline(1)[0] . getline(2)[0] . getline(3)[0] . getline(4)[0] . getline(5)[0] =~ '\.' |
1328 setf nroff | |
1329 return 1 | |
1330 endif | |
1331 return 0 | |
1219 | 1332 endfunc |
7 | 1333 |
1334 " Nroff or Objective C++ | |
216 | 1335 au BufNewFile,BufRead *.mm call s:FTmm() |
7 | 1336 |
1219 | 1337 func! s:FTmm() |
7 | 1338 let n = 1 |
1339 while n < 10 | |
1340 let line = getline(n) | |
7013 | 1341 if line =~ '^\s*\(#\s*\(include\|import\)\>\|@import\>\|/\*\)' |
7 | 1342 setf objcpp |
1343 return | |
1344 endif | |
1345 let n = n + 1 | |
1346 endwhile | |
1347 setf nroff | |
1219 | 1348 endfunc |
7 | 1349 |
1350 " Not Quite C | |
1351 au BufNewFile,BufRead *.nqc setf nqc | |
1352 | |
1353 " NSIS | |
3492 | 1354 au BufNewFile,BufRead *.nsi,*.nsh setf nsis |
7 | 1355 |
1356 " OCAML | |
3312 | 1357 au BufNewFile,BufRead *.ml,*.mli,*.mll,*.mly,.ocamlinit setf ocaml |
7 | 1358 |
1359 " Occam | |
1360 au BufNewFile,BufRead *.occ setf occam | |
1361 | |
1362 " Omnimark | |
1363 au BufNewFile,BufRead *.xom,*.xin setf omnimark | |
1364 | |
1365 " OpenROAD | |
1366 au BufNewFile,BufRead *.or setf openroad | |
1367 | |
1368 " OPL | |
1369 au BufNewFile,BufRead *.[Oo][Pp][Ll] setf opl | |
1370 | |
1371 " Oracle config file | |
1372 au BufNewFile,BufRead *.ora setf ora | |
1373 | |
1374 " Packet filter conf | |
1375 au BufNewFile,BufRead pf.conf setf pf | |
1376 | |
375 | 1377 " Pam conf |
2751 | 1378 au BufNewFile,BufRead */etc/pam.conf setf pamconf |
375 | 1379 |
7 | 1380 " PApp |
1381 au BufNewFile,BufRead *.papp,*.pxml,*.pxsl setf papp | |
1382 | |
389 | 1383 " Password file |
2751 | 1384 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 | 1385 |
7 | 1386 " Pascal (also *.p) |
1387 au BufNewFile,BufRead *.pas setf pascal | |
1388 | |
1389 " Delphi project file | |
1390 au BufNewFile,BufRead *.dpr setf pascal | |
1391 | |
1648 | 1392 " PDF |
1393 au BufNewFile,BufRead *.pdf setf pdf | |
1394 | |
7 | 1395 " Perl |
1396 if has("fname_case") | |
216 | 1397 au BufNewFile,BufRead *.pl,*.PL call s:FTpl() |
7 | 1398 else |
216 | 1399 au BufNewFile,BufRead *.pl call s:FTpl() |
7 | 1400 endif |
2034 | 1401 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
|
1402 au BufNewFile,BufRead *.p6,*.pm6,*.pl6 setf perl6 |
7 | 1403 |
1219 | 1404 func! s:FTpl() |
7 | 1405 if exists("g:filetype_pl") |
1406 exe "setf " . g:filetype_pl | |
1407 else | |
1408 " recognize Prolog by specific text in the first non-empty line | |
1409 " require a blank after the '%' because Perl uses "%list" and "%translate" | |
1410 let l = getline(nextnonblank(1)) | |
1411 if l =~ '\<prolog\>' || l =~ '^\s*\(%\+\(\s\|$\)\|/\*\)' || l =~ ':-' | |
1412 setf prolog | |
1413 else | |
1414 setf perl | |
1415 endif | |
1416 endif | |
1219 | 1417 endfunc |
7 | 1418 |
1419 " Perl, XPM or XPM2 | |
1420 au BufNewFile,BufRead *.pm | |
1421 \ if getline(1) =~ "XPM2" | | |
1422 \ setf xpm2 | | |
1423 \ elseif getline(1) =~ "XPM" | | |
1424 \ setf xpm | | |
1425 \ else | | |
1426 \ setf perl | | |
1427 \ endif | |
1428 | |
1429 " Perl POD | |
1430 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
|
1431 au BufNewFile,BufRead *.pod6 setf pod6 |
7 | 1432 |
850 | 1433 " Php, php3, php4, etc. |
1648 | 1434 " Also Phtml (was used for PHP 2 in the past) |
1435 " Also .ctp for Cake template file | |
1436 au BufNewFile,BufRead *.php,*.php\d,*.phtml,*.ctp setf php | |
7 | 1437 |
1438 " Pike | |
1439 au BufNewFile,BufRead *.pike,*.lpc,*.ulpc,*.pmod setf pike | |
1440 | |
1441 " Pinfo config | |
1442 au BufNewFile,BufRead */etc/pinforc,*/.pinforc setf pinfo | |
1443 | |
1444 " Palm Resource compiler | |
1445 au BufNewFile,BufRead *.rcp setf pilrc | |
1446 | |
1447 " Pine config | |
1448 au BufNewFile,BufRead .pinerc,pinerc,.pinercex,pinercex setf pine | |
1449 | |
5239 | 1450 " PL/1, PL/I |
1451 au BufNewFile,BufRead *.pli,*.pl1 setf pli | |
1452 | |
7 | 1453 " PL/M (also: *.inp) |
1454 au BufNewFile,BufRead *.plm,*.p36,*.pac setf plm | |
1455 | |
1456 " PL/SQL | |
1457 au BufNewFile,BufRead *.pls,*.plsql setf plsql | |
1458 | |
1459 " PLP | |
1460 au BufNewFile,BufRead *.plp setf plp | |
1461 | |
1462 " PO and PO template (GNU gettext) | |
1463 au BufNewFile,BufRead *.po,*.pot setf po | |
1464 | |
1465 " Postfix main config | |
1466 au BufNewFile,BufRead main.cf setf pfmain | |
1467 | |
1468 " PostScript (+ font files, encapsulated PostScript, Adobe Illustrator) | |
1469 au BufNewFile,BufRead *.ps,*.pfa,*.afm,*.eps,*.epsf,*.epsi,*.ai setf postscr | |
1470 | |
1471 " PostScript Printer Description | |
1472 au BufNewFile,BufRead *.ppd setf ppd | |
1473 | |
1474 " Povray | |
1475 au BufNewFile,BufRead *.pov setf pov | |
1476 | |
1477 " Povray configuration | |
1478 au BufNewFile,BufRead .povrayrc setf povini | |
1479 | |
1480 " Povray, PHP or assembly | |
216 | 1481 au BufNewFile,BufRead *.inc call s:FTinc() |
7 | 1482 |
1219 | 1483 func! s:FTinc() |
7 | 1484 if exists("g:filetype_inc") |
1485 exe "setf " . g:filetype_inc | |
1486 else | |
1487 let lines = getline(1).getline(2).getline(3) | |
1488 if lines =~? "perlscript" | |
1489 setf aspperl | |
1490 elseif lines =~ "<%" | |
1491 setf aspvbs | |
1492 elseif lines =~ "<?" | |
1493 setf php | |
1494 else | |
216 | 1495 call s:FTasmsyntax() |
7 | 1496 if exists("b:asmsyntax") |
1698 | 1497 exe "setf " . fnameescape(b:asmsyntax) |
7 | 1498 else |
1499 setf pov | |
1500 endif | |
1501 endif | |
1502 endif | |
1219 | 1503 endfunc |
7 | 1504 |
1505 " Printcap and Termcap | |
1506 au BufNewFile,BufRead *printcap | |
1507 \ let b:ptcap_type = "print" | setf ptcap | |
1508 au BufNewFile,BufRead *termcap | |
1509 \ let b:ptcap_type = "term" | setf ptcap | |
1510 | |
1511 " PCCTS / ANTRL | |
1512 "au BufNewFile,BufRead *.g setf antrl | |
1513 au BufNewFile,BufRead *.g setf pccts | |
1514 | |
1515 " PPWizard | |
1516 au BufNewFile,BufRead *.it,*.ih setf ppwiz | |
1517 | |
2152 | 1518 " Obj 3D file format |
1519 " TODO: is there a way to avoid MS-Windows Object files? | |
2725 | 1520 au BufNewFile,BufRead *.obj setf obj |
2152 | 1521 |
7 | 1522 " Oracle Pro*C/C++ |
1287 | 1523 au BufNewFile,BufRead *.pc setf proc |
7 | 1524 |
1125 | 1525 " Privoxy actions file |
1526 au BufNewFile,BufRead *.action setf privoxy | |
1527 | |
7 | 1528 " Procmail |
1529 au BufNewFile,BufRead .procmail,.procmailrc setf procmail | |
1530 | |
1531 " Progress or CWEB | |
216 | 1532 au BufNewFile,BufRead *.w call s:FTprogress_cweb() |
7 | 1533 |
1219 | 1534 func! s:FTprogress_cweb() |
7 | 1535 if exists("g:filetype_w") |
1536 exe "setf " . g:filetype_w | |
1537 return | |
1538 endif | |
1539 if getline(1) =~ '&ANALYZE' || getline(3) =~ '&GLOBAL-DEFINE' | |
1540 setf progress | |
1541 else | |
1542 setf cweb | |
1543 endif | |
1219 | 1544 endfunc |
7 | 1545 |
1546 " Progress or assembly | |
216 | 1547 au BufNewFile,BufRead *.i call s:FTprogress_asm() |
7 | 1548 |
1219 | 1549 func! s:FTprogress_asm() |
7 | 1550 if exists("g:filetype_i") |
1551 exe "setf " . g:filetype_i | |
1552 return | |
1553 endif | |
1554 " This function checks for an assembly comment the first ten lines. | |
1555 " If not found, assume Progress. | |
1556 let lnum = 1 | |
500 | 1557 while lnum <= 10 && lnum < line('$') |
7 | 1558 let line = getline(lnum) |
1559 if line =~ '^\s*;' || line =~ '^\*' | |
216 | 1560 call s:FTasm() |
7 | 1561 return |
1562 elseif line !~ '^\s*$' || line =~ '^/\*' | |
1563 " Not an empty line: Doesn't look like valid assembly code. | |
1564 " Or it looks like a Progress /* comment | |
1565 break | |
1566 endif | |
1567 let lnum = lnum + 1 | |
1568 endw | |
1569 setf progress | |
1219 | 1570 endfunc |
7 | 1571 |
1572 " Progress or Pascal | |
216 | 1573 au BufNewFile,BufRead *.p call s:FTprogress_pascal() |
7 | 1574 |
1219 | 1575 func! s:FTprogress_pascal() |
7 | 1576 if exists("g:filetype_p") |
1577 exe "setf " . g:filetype_p | |
1578 return | |
1579 endif | |
1580 " This function checks for valid Pascal syntax in the first ten lines. | |
1581 " Look for either an opening comment or a program start. | |
1582 " If not found, assume Progress. | |
1583 let lnum = 1 | |
500 | 1584 while lnum <= 10 && lnum < line('$') |
7 | 1585 let line = getline(lnum) |
500 | 1586 if line =~ '^\s*\(program\|unit\|procedure\|function\|const\|type\|var\)\>' |
7 | 1587 \ || line =~ '^\s*{' || line =~ '^\s*(\*' |
1588 setf pascal | |
1589 return | |
1590 elseif line !~ '^\s*$' || line =~ '^/\*' | |
1591 " Not an empty line: Doesn't look like valid Pascal code. | |
1592 " Or it looks like a Progress /* comment | |
1593 break | |
1594 endif | |
1595 let lnum = lnum + 1 | |
1596 endw | |
1597 setf progress | |
1219 | 1598 endfunc |
7 | 1599 |
1600 | |
1601 " Software Distributor Product Specification File (POSIX 1387.2-1995) | |
1602 au BufNewFile,BufRead *.psf setf psf | |
1603 au BufNewFile,BufRead INDEX,INFO | |
1604 \ if getline(1) =~ '^\s*\(distribution\|installed_software\|root\|bundle\|product\)\s*$' | | |
1605 \ setf psf | | |
1606 \ endif | |
1607 | |
1608 " Prolog | |
1609 au BufNewFile,BufRead *.pdb setf prolog | |
1610 | |
1648 | 1611 " Promela |
1612 au BufNewFile,BufRead *.pml setf promela | |
1613 | |
4869 | 1614 " Google protocol buffers |
1615 au BufNewFile,BufRead *.proto setf proto | |
1616 | |
389 | 1617 " Protocols |
2751 | 1618 au BufNewFile,BufRead */etc/protocols setf protocols |
389 | 1619 |
7 | 1620 " Pyrex |
1621 au BufNewFile,BufRead *.pyx,*.pxd setf pyrex | |
1622 | |
9533
9f921133ee90
commit https://github.com/vim/vim/commit/269f595f9eef584937e7eae70fde68cdd7da5bcf
Christian Brabandt <cb@256bit.org>
parents:
9407
diff
changeset
|
1623 " Python, Python Shell Startup Files |
1676 | 1624 " Quixote (Python-based web framework) |
9533
9f921133ee90
commit https://github.com/vim/vim/commit/269f595f9eef584937e7eae70fde68cdd7da5bcf
Christian Brabandt <cb@256bit.org>
parents:
9407
diff
changeset
|
1625 au BufNewFile,BufRead *.py,*.pyw,.pythonstartup,.pythonrc,*.ptl setf python |
1676 | 1626 |
7 | 1627 " Radiance |
1628 au BufNewFile,BufRead *.rad,*.mat setf radiance | |
1629 | |
1630 " Ratpoison config/command files | |
1631 au BufNewFile,BufRead .ratpoisonrc,ratpoisonrc setf ratpoison | |
1632 | |
1633 " RCS file | |
1634 au BufNewFile,BufRead *\,v setf rcs | |
1635 | |
1636 " Readline | |
237 | 1637 au BufNewFile,BufRead .inputrc,inputrc setf readline |
7 | 1638 |
1639 " Registry for MS-Windows | |
1640 au BufNewFile,BufRead *.reg | |
1641 \ if getline(1) =~? '^REGEDIT[0-9]*\s*$\|^Windows Registry Editor Version \d*\.\d*\s*$' | setf registry | endif | |
1642 | |
1643 " Renderman Interface Bytestream | |
1644 au BufNewFile,BufRead *.rib setf rib | |
1645 | |
1646 " Rexx | |
3893 | 1647 au BufNewFile,BufRead *.rex,*.orx,*.rxo,*.rxj,*.jrexx,*.rexxj,*.rexx,*.testGroup,*.testUnit setf rexx |
7 | 1648 |
1649 " R (Splus) | |
836 | 1650 if has("fname_case") |
1651 au BufNewFile,BufRead *.s,*.S setf r | |
1652 else | |
1653 au BufNewFile,BufRead *.s setf r | |
1654 endif | |
7 | 1655 |
699 | 1656 " R Help file |
836 | 1657 if has("fname_case") |
1658 au BufNewFile,BufRead *.rd,*.Rd setf rhelp | |
1659 else | |
1660 au BufNewFile,BufRead *.rd setf rhelp | |
1661 endif | |
1662 | |
1663 " R noweb file | |
1664 if has("fname_case") | |
1665 au BufNewFile,BufRead *.Rnw,*.rnw,*.Snw,*.snw setf rnoweb | |
1666 else | |
1667 au BufNewFile,BufRead *.rnw,*.snw setf rnoweb | |
1668 endif | |
699 | 1669 |
6051 | 1670 " R Markdown file |
1671 if has("fname_case") | |
1672 au BufNewFile,BufRead *.Rmd,*.rmd,*.Smd,*.smd setf rmd | |
1673 else | |
1674 au BufNewFile,BufRead *.rmd,*.smd setf rmd | |
1675 endif | |
1676 | |
1677 " R reStructuredText file | |
1678 if has("fname_case") | |
1679 au BufNewFile,BufRead *.Rrst,*.rrst,*.Srst,*.srst setf rrst | |
1680 else | |
1681 au BufNewFile,BufRead *.rrst,*.srst setf rrst | |
1682 endif | |
1683 | |
7 | 1684 " Rexx, Rebol or R |
216 | 1685 au BufNewFile,BufRead *.r,*.R call s:FTr() |
7 | 1686 |
1219 | 1687 func! s:FTr() |
1125 | 1688 let max = line("$") > 50 ? 50 : line("$") |
1689 | |
1690 for n in range(1, max) | |
1691 " Rebol is easy to recognize, check for that first | |
1648 | 1692 if getline(n) =~? '\<REBOL\>' |
1125 | 1693 setf rebol |
1694 return | |
7 | 1695 endif |
1125 | 1696 endfor |
1697 | |
1698 for n in range(1, max) | |
1699 " R has # comments | |
1700 if getline(n) =~ '^\s*#' | |
1701 setf r | |
1702 return | |
1703 endif | |
1704 " Rexx has /* comments */ | |
1705 if getline(n) =~ '^\s*/\*' | |
7 | 1706 setf rexx |
1125 | 1707 return |
7 | 1708 endif |
1125 | 1709 endfor |
1710 | |
2965 | 1711 " Nothing recognized, use user default or assume Rexx |
1712 if exists("g:filetype_r") | |
1713 exe "setf " . g:filetype_r | |
1714 else | |
1715 " Rexx used to be the default, but R appears to be much more popular. | |
1716 setf r | |
1717 endif | |
1219 | 1718 endfunc |
7 | 1719 |
1720 " Remind | |
2788 | 1721 au BufNewFile,BufRead .reminders,*.remind,*.rem setf remind |
7 | 1722 |
1723 " Resolv.conf | |
1724 au BufNewFile,BufRead resolv.conf setf resolv | |
1725 | |
1726 " Relax NG Compact | |
1727 au BufNewFile,BufRead *.rnc setf rnc | |
1728 | |
4264 | 1729 " Relax NG XML |
1730 au BufNewFile,BufRead *.rng setf rng | |
1731 | |
7 | 1732 " RPL/2 |
1733 au BufNewFile,BufRead *.rpl setf rpl | |
1734 | |
1735 " Robots.txt | |
1736 au BufNewFile,BufRead robots.txt setf robots | |
1737 | |
1738 " Rpcgen | |
1739 au BufNewFile,BufRead *.x setf rpcgen | |
1740 | |
1741 " reStructuredText Documentation Format | |
1742 au BufNewFile,BufRead *.rst setf rst | |
1743 | |
1744 " RTF | |
1745 au BufNewFile,BufRead *.rtf setf rtf | |
1746 | |
1676 | 1747 " Interactive Ruby shell |
1748 au BufNewFile,BufRead .irbrc,irbrc setf ruby | |
1749 | |
7 | 1750 " Ruby |
2681 | 1751 au BufNewFile,BufRead *.rb,*.rbw setf ruby |
1752 | |
1753 " RubyGems | |
1754 au BufNewFile,BufRead *.gemspec setf ruby | |
1755 | |
1756 " Rackup | |
1757 au BufNewFile,BufRead *.ru setf ruby | |
1758 | |
1759 " Bundler | |
1760 au BufNewFile,BufRead Gemfile setf ruby | |
7 | 1761 |
1219 | 1762 " Ruby on Rails |
1763 au BufNewFile,BufRead *.builder,*.rxml,*.rjs setf ruby | |
1764 | |
1765 " Rantfile and Rakefile is like Ruby | |
1766 au BufNewFile,BufRead [rR]antfile,*.rant,[rR]akefile,*.rake setf ruby | |
557 | 1767 |
2034 | 1768 " S-lang (or shader language, or SmallLisp) |
7 | 1769 au BufNewFile,BufRead *.sl setf slang |
1770 | |
1771 " Samba config | |
1772 au BufNewFile,BufRead smb.conf setf samba | |
1773 | |
1774 " SAS script | |
1775 au BufNewFile,BufRead *.sas setf sas | |
1776 | |
1668 | 1777 " Sass |
1778 au BufNewFile,BufRead *.sass setf sass | |
1779 | |
7 | 1780 " Sather |
1781 au BufNewFile,BufRead *.sa setf sather | |
1782 | |
9975
03fa8a51e9dc
commit https://github.com/vim/vim/commit/e4a3bcf28d92d0bde9ca227ccb40d401038185e5
Christian Brabandt <cb@256bit.org>
parents:
9908
diff
changeset
|
1783 " Scala |
03fa8a51e9dc
commit https://github.com/vim/vim/commit/e4a3bcf28d92d0bde9ca227ccb40d401038185e5
Christian Brabandt <cb@256bit.org>
parents:
9908
diff
changeset
|
1784 au BufNewFile,BufRead *.scala setf scala |
03fa8a51e9dc
commit https://github.com/vim/vim/commit/e4a3bcf28d92d0bde9ca227ccb40d401038185e5
Christian Brabandt <cb@256bit.org>
parents:
9908
diff
changeset
|
1785 |
7 | 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. | |
9041
34c45ee4210d
commit https://github.com/vim/vim/commit/06481427005a9dae39721087df94855f7d4d1feb
Christian Brabandt <cb@256bit.org>
parents:
7301
diff
changeset
|
1864 " Gentoo ebuilds and Arch Linux PKGBUILDs are actually bash scripts |
34c45ee4210d
commit https://github.com/vim/vim/commit/06481427005a9dae39721087df94855f7d4d1feb
Christian Brabandt <cb@256bit.org>
parents:
7301
diff
changeset
|
1865 au BufNewFile,BufRead .bashrc*,bashrc,bash.bashrc,.bash[_-]profile*,.bash[_-]logout*,.bash[_-]aliases*,*.bash,*/{,.}bash[_-]completion{,.d,.sh}{,/*},*.ebuild,*.eclass,PKGBUILD* 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 |
9041
34c45ee4210d
commit https://github.com/vim/vim/commit/06481427005a9dae39721087df94855f7d4d1feb
Christian Brabandt <cb@256bit.org>
parents:
7301
diff
changeset
|
1869 " Shell script (Arch Linux) or PHP file (Drupal) |
34c45ee4210d
commit https://github.com/vim/vim/commit/06481427005a9dae39721087df94855f7d4d1feb
Christian Brabandt <cb@256bit.org>
parents:
7301
diff
changeset
|
1870 au BufNewFile,BufRead *.install |
34c45ee4210d
commit https://github.com/vim/vim/commit/06481427005a9dae39721087df94855f7d4d1feb
Christian Brabandt <cb@256bit.org>
parents:
7301
diff
changeset
|
1871 \ if getline(1) =~ '<?php' | |
34c45ee4210d
commit https://github.com/vim/vim/commit/06481427005a9dae39721087df94855f7d4d1feb
Christian Brabandt <cb@256bit.org>
parents:
7301
diff
changeset
|
1872 \ setf php | |
34c45ee4210d
commit https://github.com/vim/vim/commit/06481427005a9dae39721087df94855f7d4d1feb
Christian Brabandt <cb@256bit.org>
parents:
7301
diff
changeset
|
1873 \ else | |
34c45ee4210d
commit https://github.com/vim/vim/commit/06481427005a9dae39721087df94855f7d4d1feb
Christian Brabandt <cb@256bit.org>
parents:
7301
diff
changeset
|
1874 \ call SetFileTypeSH("bash") | |
34c45ee4210d
commit https://github.com/vim/vim/commit/06481427005a9dae39721087df94855f7d4d1feb
Christian Brabandt <cb@256bit.org>
parents:
7301
diff
changeset
|
1875 \ endif |
34c45ee4210d
commit https://github.com/vim/vim/commit/06481427005a9dae39721087df94855f7d4d1feb
Christian Brabandt <cb@256bit.org>
parents:
7301
diff
changeset
|
1876 |
216 | 1877 " Also called from scripts.vim. |
1219 | 1878 func! SetFileTypeSH(name) |
216 | 1879 if expand("<amatch>") =~ g:ft_ignore_pat |
1880 return | |
1881 endif | |
2034 | 1882 if a:name =~ '\<csh\>' |
1883 " Some .sh scripts contain #!/bin/csh. | |
1884 call SetFileTypeShell("csh") | |
1885 return | |
1886 elseif a:name =~ '\<tcsh\>' | |
1887 " Some .sh scripts contain #!/bin/tcsh. | |
1888 call SetFileTypeShell("tcsh") | |
1889 return | |
3830 | 1890 elseif a:name =~ '\<zsh\>' |
1891 " Some .sh scripts contain #!/bin/zsh. | |
1892 call SetFileTypeShell("zsh") | |
1893 return | |
2034 | 1894 elseif a:name =~ '\<ksh\>' |
7 | 1895 let b:is_kornshell = 1 |
1896 if exists("b:is_bash") | |
1897 unlet b:is_bash | |
1898 endif | |
1899 if exists("b:is_sh") | |
1900 unlet b:is_sh | |
1901 endif | |
1902 elseif exists("g:bash_is_sh") || a:name =~ '\<bash\>' || a:name =~ '\<bash2\>' | |
1903 let b:is_bash = 1 | |
1904 if exists("b:is_kornshell") | |
1905 unlet b:is_kornshell | |
1906 endif | |
1907 if exists("b:is_sh") | |
1908 unlet b:is_sh | |
1909 endif | |
1910 elseif a:name =~ '\<sh\>' | |
1911 let b:is_sh = 1 | |
1912 if exists("b:is_kornshell") | |
1913 unlet b:is_kornshell | |
1914 endif | |
1915 if exists("b:is_bash") | |
1916 unlet b:is_bash | |
1917 endif | |
1918 endif | |
26 | 1919 call SetFileTypeShell("sh") |
1219 | 1920 endfunc |
26 | 1921 |
1922 " For shell-like file types, check for an "exec" command hidden in a comment, | |
1923 " as used for Tcl. | |
216 | 1924 " Also called from scripts.vim, thus can't be local to this script. |
1219 | 1925 func! SetFileTypeShell(name) |
216 | 1926 if expand("<amatch>") =~ g:ft_ignore_pat |
1927 return | |
1928 endif | |
26 | 1929 let l = 2 |
1930 while l < 20 && l < line("$") && getline(l) =~ '^\s*\(#\|$\)' | |
1931 " Skip empty and comment lines. | |
1932 let l = l + 1 | |
1933 endwhile | |
1934 if l < line("$") && getline(l) =~ '\s*exec\s' && getline(l - 1) =~ '^\s*#.*\\$' | |
1935 " Found an "exec" line after a comment with continuation | |
1936 let n = substitute(getline(l),'\s*exec\s\+\([^ ]*/\)\=', '', '') | |
1937 if n =~ '\<tclsh\|\<wish' | |
1938 setf tcl | |
1939 return | |
1940 endif | |
1941 endif | |
1942 exe "setf " . a:name | |
1219 | 1943 endfunc |
7 | 1944 |
1945 " tcsh scripts | |
26 | 1946 au BufNewFile,BufRead .tcshrc*,*.tcsh,tcsh.tcshrc,tcsh.login call SetFileTypeShell("tcsh") |
7 | 1947 |
1948 " csh scripts, but might also be tcsh scripts (on some systems csh is tcsh) | |
216 | 1949 au BufNewFile,BufRead .login*,.cshrc*,csh.cshrc,csh.login,csh.logout,*.csh,.alias call s:CSH() |
7 | 1950 |
1219 | 1951 func! s:CSH() |
7 | 1952 if exists("g:filetype_csh") |
26 | 1953 call SetFileTypeShell(g:filetype_csh) |
7 | 1954 elseif &shell =~ "tcsh" |
26 | 1955 call SetFileTypeShell("tcsh") |
7 | 1956 else |
26 | 1957 call SetFileTypeShell("csh") |
7 | 1958 endif |
1219 | 1959 endfunc |
7 | 1960 |
1961 " Z-Shell script | |
2751 | 1962 au BufNewFile,BufRead .zprofile,*/etc/zprofile,.zfbfmarks setf zsh |
216 | 1963 au BufNewFile,BufRead .zsh*,.zlog*,.zcompdump* call s:StarSetf('zsh') |
2725 | 1964 au BufNewFile,BufRead *.zsh setf zsh |
7 | 1965 |
1966 " Scheme | |
3513 | 1967 au BufNewFile,BufRead *.scm,*.ss,*.rkt setf scheme |
7 | 1968 |
1969 " Screen RC | |
1970 au BufNewFile,BufRead .screenrc,screenrc setf screen | |
1971 | |
1972 " Simula | |
1973 au BufNewFile,BufRead *.sim setf simula | |
1974 | |
1975 " SINDA | |
1976 au BufNewFile,BufRead *.sin,*.s85 setf sinda | |
1977 | |
819 | 1978 " SiSU |
857 | 1979 au BufNewFile,BufRead *.sst,*.ssm,*.ssi,*.-sst,*._sst setf sisu |
819 | 1980 au BufNewFile,BufRead *.sst.meta,*.-sst.meta,*._sst.meta setf sisu |
1981 | |
7 | 1982 " SKILL |
336 | 1983 au BufNewFile,BufRead *.il,*.ils,*.cdf setf skill |
7 | 1984 |
1985 " SLRN | |
1986 au BufNewFile,BufRead .slrnrc setf slrnrc | |
1987 au BufNewFile,BufRead *.score setf slrnsc | |
1988 | |
271 | 1989 " Smalltalk (and TeX) |
1990 au BufNewFile,BufRead *.st setf st | |
1991 au BufNewFile,BufRead *.cls | |
1992 \ if getline(1) =~ '^%' | | |
1993 \ setf tex | | |
3893 | 1994 \ elseif getline(1)[0] == '#' && getline(1) =~ 'rexx' | |
1995 \ setf rexx | | |
271 | 1996 \ else | |
1997 \ setf st | | |
1998 \ endif | |
7 | 1999 |
2000 " Smarty templates | |
2001 au BufNewFile,BufRead *.tpl setf smarty | |
2002 | |
2003 " SMIL or XML | |
2004 au BufNewFile,BufRead *.smil | |
2005 \ if getline(1) =~ '<?\s*xml.*?>' | | |
2006 \ setf xml | | |
2007 \ else | | |
2008 \ setf smil | | |
2009 \ endif | |
2010 | |
2011 " SMIL or SNMP MIB file | |
2012 au BufNewFile,BufRead *.smi | |
2013 \ if getline(1) =~ '\<smil\>' | | |
2014 \ setf smil | | |
2015 \ else | | |
2016 \ setf mib | | |
2017 \ endif | |
2018 | |
2019 " SMITH | |
2020 au BufNewFile,BufRead *.smt,*.smith setf smith | |
2021 | |
857 | 2022 " Snobol4 and spitbol |
2023 au BufNewFile,BufRead *.sno,*.spt setf snobol4 | |
7 | 2024 |
2025 " SNMP MIB files | |
2026 au BufNewFile,BufRead *.mib,*.my setf mib | |
2027 | |
2028 " Snort Configuration | |
1219 | 2029 au BufNewFile,BufRead *.hog,snort.conf,vision.conf setf hog |
2030 au BufNewFile,BufRead *.rules call s:FTRules() | |
2031 | |
2032 let s:ft_rules_udev_rules_pattern = '^\s*\cudev_rules\s*=\s*"\([^"]\{-1,}\)/*".*' | |
2033 func! s:FTRules() | |
2034 | 2034 let path = expand('<amatch>:p') |
2751 | 2035 if path =~ '^/\(etc/udev/\%(rules\.d/\)\=.*\.rules\|lib/udev/\%(rules\.d/\)\=.*\.rules\)$' |
1648 | 2036 setf udevrules |
2037 return | |
2038 endif | |
2034 | 2039 if path =~ '^/etc/ufw/' |
2040 setf conf " Better than hog | |
2041 return | |
2042 endif | |
6505 | 2043 if path =~ '^/\(etc\|usr/share\)/polkit-1/rules\.d' |
2044 setf javascript | |
2045 return | |
2046 endif | |
1219 | 2047 try |
2048 let config_lines = readfile('/etc/udev/udev.conf') | |
2049 catch /^Vim\%((\a\+)\)\=:E484/ | |
2050 setf hog | |
2051 return | |
2052 endtry | |
1648 | 2053 let dir = expand('<amatch>:p:h') |
1219 | 2054 for line in config_lines |
2055 if line =~ s:ft_rules_udev_rules_pattern | |
2056 let udev_rules = substitute(line, s:ft_rules_udev_rules_pattern, '\1', "") | |
1648 | 2057 if dir == udev_rules |
9975
03fa8a51e9dc
commit https://github.com/vim/vim/commit/e4a3bcf28d92d0bde9ca227ccb40d401038185e5
Christian Brabandt <cb@256bit.org>
parents:
9908
diff
changeset
|
2058 setf udevrules |
1219 | 2059 endif |
2060 break | |
2061 endif | |
2062 endfor | |
2063 setf hog | |
2064 endfunc | |
2065 | |
7 | 2066 |
2067 " Spec (Linux RPM) | |
2068 au BufNewFile,BufRead *.spec setf spec | |
2069 | |
2070 " Speedup (AspenTech plant simulator) | |
2071 au BufNewFile,BufRead *.speedup,*.spdata,*.spd setf spup | |
2072 | |
2073 " Slice | |
2074 au BufNewFile,BufRead *.ice setf slice | |
2075 | |
2076 " Spice | |
2077 au BufNewFile,BufRead *.sp,*.spice setf spice | |
2078 | |
2079 " Spyce | |
2080 au BufNewFile,BufRead *.spy,*.spi setf spyce | |
2081 | |
2082 " Squid | |
2083 au BufNewFile,BufRead squid.conf setf squid | |
2084 | |
22 | 2085 " SQL for Oracle Designer |
2086 au BufNewFile,BufRead *.tyb,*.typ,*.tyc,*.pkb,*.pks setf sql | |
2087 | |
2088 " SQL | |
216 | 2089 au BufNewFile,BufRead *.sql call s:SQL() |
22 | 2090 |
1219 | 2091 func! s:SQL() |
22 | 2092 if exists("g:filetype_sql") |
2093 exe "setf " . g:filetype_sql | |
2094 else | |
2095 setf sql | |
2096 endif | |
1219 | 2097 endfunc |
7 | 2098 |
2099 " SQLJ | |
2100 au BufNewFile,BufRead *.sqlj setf sqlj | |
2101 | |
2102 " SQR | |
2103 au BufNewFile,BufRead *.sqr,*.sqi setf sqr | |
2104 | |
2105 " OpenSSH configuration | |
2106 au BufNewFile,BufRead ssh_config,*/.ssh/config setf sshconfig | |
2107 | |
2108 " OpenSSH server configuration | |
2109 au BufNewFile,BufRead sshd_config setf sshdconfig | |
2110 | |
831 | 2111 " Stata |
2112 au BufNewFile,BufRead *.ado,*.class,*.do,*.imata,*.mata setf stata | |
2113 | |
2114 " SMCL | |
2115 au BufNewFile,BufRead *.hlp,*.ihlp,*.smcl setf smcl | |
2116 | |
7 | 2117 " Stored Procedures |
2118 au BufNewFile,BufRead *.stp setf stp | |
2119 | |
2120 " Standard ML | |
2121 au BufNewFile,BufRead *.sml setf sml | |
2122 | |
1648 | 2123 " Sratus VOS command macro |
2124 au BufNewFile,BufRead *.cm setf voscm | |
2125 | |
375 | 2126 " Sysctl |
2751 | 2127 au BufNewFile,BufRead */etc/sysctl.conf,*/etc/sysctl.d/*.conf setf sysctl |
375 | 2128 |
7176
30042ddff503
commit https://github.com/vim/vim/commit/60cce2fb736c8ff6fdb9603f502d3c15f1f7a25d
Christian Brabandt <cb@256bit.org>
parents:
7147
diff
changeset
|
2129 " Systemd unit files |
30042ddff503
commit https://github.com/vim/vim/commit/60cce2fb736c8ff6fdb9603f502d3c15f1f7a25d
Christian Brabandt <cb@256bit.org>
parents:
7147
diff
changeset
|
2130 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
|
2131 |
2034 | 2132 " Synopsys Design Constraints |
2133 au BufNewFile,BufRead *.sdc setf sdc | |
2134 | |
39 | 2135 " Sudoers |
2751 | 2136 au BufNewFile,BufRead */etc/sudoers,sudoers.tmp setf sudoers |
39 | 2137 |
2152 | 2138 " SVG (Scalable Vector Graphics) |
2139 au BufNewFile,BufRead *.svg setf svg | |
2140 | |
5425 | 2141 " If the file has an extension of 't' and is in a directory 't' or 'xt' then |
2142 " it is almost certainly a Perl test file. | |
557 | 2143 " If the first line starts with '#' and contains 'perl' it's probably a Perl |
2144 " file. | |
826 | 2145 " (Slow test) If a file contains a 'use' statement then it is almost certainly |
2146 " a Perl file. | |
1219 | 2147 func! s:FTperl() |
5425 | 2148 let dirname = expand("%:p:h:t") |
2149 if expand("%:e") == 't' && (dirname == 't' || dirname == 'xt') | |
826 | 2150 setf perl |
2151 return 1 | |
2152 endif | |
557 | 2153 if getline(1)[0] == '#' && getline(1) =~ 'perl' |
2154 setf perl | |
2155 return 1 | |
2156 endif | |
826 | 2157 if search('^use\s\s*\k', 'nc', 30) |
2158 setf perl | |
2159 return 1 | |
2160 endif | |
557 | 2161 return 0 |
1219 | 2162 endfunc |
557 | 2163 |
2164 " Tads (or Nroff or Perl test file) | |
7 | 2165 au BufNewFile,BufRead *.t |
557 | 2166 \ if !s:FTnroff() && !s:FTperl() | setf tads | endif |
7 | 2167 |
2168 " Tags | |
2169 au BufNewFile,BufRead tags setf tags | |
2170 | |
2171 " TAK | |
2172 au BufNewFile,BufRead *.tak setf tak | |
2173 | |
2034 | 2174 " Task |
2175 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
|
2176 au BufRead,BufNewFile *.task setf taskedit |
2034 | 2177 |
557 | 2178 " Tcl (JACL too) |
2179 au BufNewFile,BufRead *.tcl,*.tk,*.itcl,*.itk,*.jacl setf tcl | |
7 | 2180 |
2181 " TealInfo | |
2182 au BufNewFile,BufRead *.tli setf tli | |
2183 | |
2184 " Telix Salt | |
2185 au BufNewFile,BufRead *.slt setf tsalt | |
2186 | |
6951
b2673982c625
Updated and new runtime files.
Bram Moolenaar <bram@vim.org>
parents:
6823
diff
changeset
|
2187 " Tera Term Language |
b2673982c625
Updated and new runtime files.
Bram Moolenaar <bram@vim.org>
parents:
6823
diff
changeset
|
2188 au BufRead,BufNewFile *.ttl setf teraterm |
b2673982c625
Updated and new runtime files.
Bram Moolenaar <bram@vim.org>
parents:
6823
diff
changeset
|
2189 |
7 | 2190 " Terminfo |
2191 au BufNewFile,BufRead *.ti setf terminfo | |
2192 | |
2193 " TeX | |
378 | 2194 au BufNewFile,BufRead *.latex,*.sty,*.dtx,*.ltx,*.bbl setf tex |
2195 au BufNewFile,BufRead *.tex call s:FTtex() | |
2196 | |
800 | 2197 " Choose context, plaintex, or tex (LaTeX) based on these rules: |
2198 " 1. Check the first line of the file for "%&<format>". | |
2199 " 2. Check the first 1000 non-comment lines for LaTeX or ConTeXt keywords. | |
2200 " 3. Default to "latex" or to g:tex_flavor, can be set in user's vimrc. | |
1219 | 2201 func! s:FTtex() |
800 | 2202 let firstline = getline(1) |
2203 if firstline =~ '^%&\s*\a\+' | |
2204 let format = tolower(matchstr(firstline, '\a\+')) | |
2205 let format = substitute(format, 'pdf', '', '') | |
2206 if format == 'tex' | |
2207 let format = 'plain' | |
378 | 2208 endif |
800 | 2209 else |
2210 " Default value, may be changed later: | |
2211 let format = exists("g:tex_flavor") ? g:tex_flavor : 'plain' | |
2212 " Save position, go to the top of the file, find first non-comment line. | |
2213 let save_cursor = getpos('.') | |
2214 call cursor(1,1) | |
2215 let firstNC = search('^\s*[^[:space:]%]', 'c', 1000) | |
2216 if firstNC " Check the next thousand lines for a LaTeX or ConTeXt keyword. | |
2217 let lpat = 'documentclass\>\|usepackage\>\|begin{\|newcommand\>\|renewcommand\>' | |
2218 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\>' | |
2219 let kwline = search('^\s*\\\%(' . lpat . '\)\|^\s*\\\(' . cpat . '\)', | |
2220 \ 'cnp', firstNC + 1000) | |
2221 if kwline == 1 " lpat matched | |
2222 let format = 'latex' | |
2223 elseif kwline == 2 " cpat matched | |
2224 let format = 'context' | |
2225 endif " If neither matched, keep default set above. | |
2226 " let lline = search('^\s*\\\%(' . lpat . '\)', 'cn', firstNC + 1000) | |
2227 " let cline = search('^\s*\\\%(' . cpat . '\)', 'cn', firstNC + 1000) | |
2228 " if cline > 0 | |
2229 " let format = 'context' | |
2230 " endif | |
2231 " if lline > 0 && (cline == 0 || cline > lline) | |
2232 " let format = 'tex' | |
2233 " endif | |
2234 endif " firstNC | |
2235 call setpos('.', save_cursor) | |
2236 endif " firstline =~ '^%&\s*\a\+' | |
694 | 2237 |
800 | 2238 " Translation from formats to file types. TODO: add AMSTeX, RevTex, others? |
2239 if format == 'plain' | |
2240 setf plaintex | |
2241 elseif format == 'context' | |
694 | 2242 setf context |
800 | 2243 else " probably LaTeX |
694 | 2244 setf tex |
2245 endif | |
800 | 2246 return |
1219 | 2247 endfunc |
378 | 2248 |
1648 | 2249 " ConTeXt |
2250 au BufNewFile,BufRead tex/context/*/*.tex,*.mkii,*.mkiv setf context | |
7 | 2251 |
2252 " Texinfo | |
2253 au BufNewFile,BufRead *.texinfo,*.texi,*.txi setf texinfo | |
2254 | |
2255 " TeX configuration | |
2256 au BufNewFile,BufRead texmf.cnf setf texmf | |
2257 | |
2258 " Tidy config | |
2259 au BufNewFile,BufRead .tidyrc,tidyrc setf tidy | |
2260 | |
2261 " TF mud client | |
2262 au BufNewFile,BufRead *.tf,.tfrc,tfrc setf tf | |
2263 | |
33 | 2264 " TPP - Text Presentation Program |
2265 au BufNewFile,BufReadPost *.tpp setf tpp | |
2266 | |
2725 | 2267 " Treetop |
2268 au BufRead,BufNewFile *.treetop setf treetop | |
2269 | |
555 | 2270 " Trustees |
2271 au BufNewFile,BufRead trustees.conf setf trustees | |
2272 | |
7 | 2273 " TSS - Geometry |
2274 au BufNewFile,BufReadPost *.tssgm setf tssgm | |
2275 | |
2276 " TSS - Optics | |
2277 au BufNewFile,BufReadPost *.tssop setf tssop | |
2278 | |
2279 " TSS - Command Line (temporary) | |
2280 au BufNewFile,BufReadPost *.tsscl setf tsscl | |
2281 | |
3456 | 2282 " TWIG files |
2283 au BufNewFile,BufReadPost *.twig setf twig | |
2284 | |
7 | 2285 " Motif UIT/UIL files |
2286 au BufNewFile,BufRead *.uit,*.uil setf uil | |
2287 | |
389 | 2288 " Udev conf |
2751 | 2289 au BufNewFile,BufRead */etc/udev/udev.conf setf udevconf |
389 | 2290 |
2291 " Udev permissions | |
2751 | 2292 au BufNewFile,BufRead */etc/udev/permissions.d/*.permissions setf udevperm |
389 | 2293 " |
2294 " Udev symlinks config | |
2751 | 2295 au BufNewFile,BufRead */etc/udev/cdsymlinks.conf setf sh |
389 | 2296 |
7 | 2297 " UnrealScript |
2298 au BufNewFile,BufRead *.uc setf uc | |
2299 | |
375 | 2300 " Updatedb |
2751 | 2301 au BufNewFile,BufRead */etc/updatedb.conf setf updatedb |
375 | 2302 |
2725 | 2303 " Upstart (init(8)) config files |
5362
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
5277
diff
changeset
|
2304 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
|
2305 au BufNewFile,BufRead */usr/share/upstart/*.override setf upstart |
4186 | 2306 au BufNewFile,BufRead */etc/init/*.conf,*/etc/init/*.override setf upstart |
9975
03fa8a51e9dc
commit https://github.com/vim/vim/commit/e4a3bcf28d92d0bde9ca227ccb40d401038185e5
Christian Brabandt <cb@256bit.org>
parents:
9908
diff
changeset
|
2307 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
|
2308 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
|
2309 au BufNewFile,BufRead */.config/upstart/*.override setf upstart |
2725 | 2310 |
836 | 2311 " Vera |
2312 au BufNewFile,BufRead *.vr,*.vri,*.vrh setf vera | |
2313 | |
7 | 2314 " Verilog HDL |
2315 au BufNewFile,BufRead *.v setf verilog | |
2316 | |
481 | 2317 " Verilog-AMS HDL |
2318 au BufNewFile,BufRead *.va,*.vams setf verilogams | |
2319 | |
5663
1dea14d4c738
Update runtime files. Add support for systemverilog.
Bram Moolenaar <bram@vim.org>
parents:
5577
diff
changeset
|
2320 " SystemVerilog |
5692
80e5f9584b02
Update runtime files. Add Euphoria syntax files.
Bram Moolenaar <bram@vim.org>
parents:
5663
diff
changeset
|
2321 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
|
2322 |
7 | 2323 " VHDL |
216 | 2324 au BufNewFile,BufRead *.hdl,*.vhd,*.vhdl,*.vbe,*.vst setf vhdl |
375 | 2325 au BufNewFile,BufRead *.vhdl_[0-9]* call s:StarSetf('vhdl') |
7 | 2326 |
2327 " Vim script | |
794 | 2328 au BufNewFile,BufRead *.vim,*.vba,.exrc,_exrc setf vim |
7 | 2329 |
2330 " Viminfo file | |
2331 au BufNewFile,BufRead .viminfo,_viminfo setf viminfo | |
2332 | |
2034 | 2333 " Virata Config Script File or Drupal module |
2334 au BufRead,BufNewFile *.hw,*.module,*.pkg | |
2335 \ if getline(1) =~ '<?php' | | |
2336 \ setf php | | |
2337 \ else | | |
2338 \ setf virata | | |
2339 \ endif | |
7 | 2340 |
2341 " Visual Basic (also uses *.bas) or FORM | |
216 | 2342 au BufNewFile,BufRead *.frm call s:FTVB("form") |
7 | 2343 |
2344 " SaxBasic is close to Visual Basic | |
2345 au BufNewFile,BufRead *.sba setf vb | |
2346 | |
2347 " Vgrindefs file | |
2348 au BufNewFile,BufRead vgrindefs setf vgrindefs | |
2349 | |
2350 " VRML V1.0c | |
2351 au BufNewFile,BufRead *.wrl setf vrml | |
2352 | |
6091
7090d7f160f7
Update runtime files. Add vroom file support.
Bram Moolenaar <bram@vim.org>
parents:
6070
diff
changeset
|
2353 " Vroom (vim testing and executable documentation) |
7090d7f160f7
Update runtime files. Add vroom file support.
Bram Moolenaar <bram@vim.org>
parents:
6070
diff
changeset
|
2354 au BufNewFile,BufRead *.vroom setf vroom |
7090d7f160f7
Update runtime files. Add vroom file support.
Bram Moolenaar <bram@vim.org>
parents:
6070
diff
changeset
|
2355 |
7 | 2356 " Webmacro |
2357 au BufNewFile,BufRead *.wm setf webmacro | |
2358 | |
2359 " Wget config | |
2360 au BufNewFile,BufRead .wgetrc,wgetrc setf wget | |
2361 | |
2362 " Website MetaLanguage | |
2363 au BufNewFile,BufRead *.wml setf wml | |
2364 | |
2365 " Winbatch | |
2366 au BufNewFile,BufRead *.wbt setf winbatch | |
2367 | |
753 | 2368 " WSML |
2369 au BufNewFile,BufRead *.wsml setf wsml | |
2370 | |
7 | 2371 " WvDial |
2372 au BufNewFile,BufRead wvdial.conf,.wvdialrc setf wvdial | |
2373 | |
2374 " CVS RC file | |
2375 au BufNewFile,BufRead .cvsrc setf cvsrc | |
2376 | |
2377 " CVS commit file | |
2378 au BufNewFile,BufRead cvs\d\+ setf cvs | |
2379 | |
2380 " WEB (*.web is also used for Winbatch: Guess, based on expecting "%" comment | |
2381 " lines in a WEB file). | |
2382 au BufNewFile,BufRead *.web | |
2383 \ if getline(1)[0].getline(2)[0].getline(3)[0].getline(4)[0].getline(5)[0] =~ "%" | | |
2384 \ setf web | | |
2385 \ else | | |
2386 \ setf winbatch | | |
2387 \ endif | |
2388 | |
2389 " Windows Scripting Host and Windows Script Component | |
2390 au BufNewFile,BufRead *.ws[fc] setf wsh | |
2391 | |
1125 | 2392 " XHTML |
2393 au BufNewFile,BufRead *.xhtml,*.xht setf xhtml | |
2394 | |
7 | 2395 " X Pixmap (dynamically sets colors, use BufEnter to make it work better) |
2396 au BufEnter *.xpm | |
2397 \ if getline(1) =~ "XPM2" | | |
2398 \ setf xpm2 | | |
2399 \ else | | |
2400 \ setf xpm | | |
2401 \ endif | |
2402 au BufEnter *.xpm2 setf xpm2 | |
2403 | |
2404 " XFree86 config | |
2405 au BufNewFile,BufRead XF86Config | |
2406 \ if getline(1) =~ '\<XConfigurator\>' | | |
2788 | 2407 \ let b:xf86conf_xfree86_version = 3 | |
7 | 2408 \ endif | |
2409 \ setf xf86conf | |
2751 | 2410 au BufNewFile,BufRead */xorg.conf.d/*.conf |
2411 \ let b:xf86conf_xfree86_version = 4 | | |
2412 \ setf xf86conf | |
7 | 2413 |
2414 " Xorg config | |
2751 | 2415 au BufNewFile,BufRead xorg.conf,xorg.conf-4 let b:xf86conf_xfree86_version = 4 | setf xf86conf |
7 | 2416 |
375 | 2417 " Xinetd conf |
2751 | 2418 au BufNewFile,BufRead */etc/xinetd.conf setf xinetd |
375 | 2419 |
7 | 2420 " XS Perl extension interface language |
2421 au BufNewFile,BufRead *.xs setf xs | |
2422 | |
2423 " X resources file | |
2424 au BufNewFile,BufRead .Xdefaults,.Xpdefaults,.Xresources,xdm-config,*.ad setf xdefaults | |
2425 | |
2426 " Xmath | |
2427 au BufNewFile,BufRead *.msc,*.msf setf xmath | |
2428 au BufNewFile,BufRead *.ms | |
216 | 2429 \ if !s:FTnroff() | setf xmath | endif |
7 | 2430 |
1648 | 2431 " XML specific variants: docbk and xbl |
2432 au BufNewFile,BufRead *.xml call s:FTxml() | |
2433 | |
2434 func! s:FTxml() | |
2435 let n = 1 | |
2436 while n < 100 && n < line("$") | |
2437 let line = getline(n) | |
3967 | 2438 " DocBook 4 or DocBook 5. |
2439 let is_docbook4 = line =~ '<!DOCTYPE.*DocBook' | |
2440 let is_docbook5 = line =~ ' xmlns="http://docbook.org/ns/docbook"' | |
2441 if is_docbook4 || is_docbook5 | |
1648 | 2442 let b:docbk_type = "xml" |
3967 | 2443 if is_docbook5 |
2444 let b:docbk_ver = 5 | |
2445 else | |
2446 let b:docbk_ver = 4 | |
2447 endif | |
1648 | 2448 setf docbk |
2449 return | |
2450 endif | |
2451 if line =~ 'xmlns:xbl="http://www.mozilla.org/xbl"' | |
2452 setf xbl | |
2453 return | |
2454 endif | |
2455 let n += 1 | |
2456 endwhile | |
2457 setf xml | |
2458 endfunc | |
7 | 2459 |
2460 " XMI (holding UML models) is also XML | |
2461 au BufNewFile,BufRead *.xmi setf xml | |
2462 | |
2463 " CSPROJ files are Visual Studio.NET's XML-based project config files | |
2464 au BufNewFile,BufRead *.csproj,*.csproj.user setf xml | |
2465 | |
2466 " Qt Linguist translation source and Qt User Interface Files are XML | |
2467 au BufNewFile,BufRead *.ts,*.ui setf xml | |
2468 | |
1125 | 2469 " TPM's are RDF-based descriptions of TeX packages (Nikolai Weibull) |
2470 au BufNewFile,BufRead *.tpm setf xml | |
2471 | |
389 | 2472 " Xdg menus |
2751 | 2473 au BufNewFile,BufRead */etc/xdg/menus/*.menu setf xml |
389 | 2474 |
1648 | 2475 " ATI graphics driver configuration |
2476 au BufNewFile,BufRead fglrxrc setf xml | |
2477 | |
2478 " XLIFF (XML Localisation Interchange File Format) is also XML | |
2479 au BufNewFile,BufRead *.xlf setf xml | |
2480 au BufNewFile,BufRead *.xliff setf xml | |
2481 | |
3410
94601b379f38
Updated runtime files. Add Dutch translations.
Bram Moolenaar <bram@vim.org>
parents:
3356
diff
changeset
|
2482 " XML User Interface Language |
94601b379f38
Updated runtime files. Add Dutch translations.
Bram Moolenaar <bram@vim.org>
parents:
3356
diff
changeset
|
2483 au BufNewFile,BufRead *.xul setf xml |
94601b379f38
Updated runtime files. Add Dutch translations.
Bram Moolenaar <bram@vim.org>
parents:
3356
diff
changeset
|
2484 |
1648 | 2485 " X11 xmodmap (also see below) |
2486 au BufNewFile,BufRead *Xmodmap setf xmodmap | |
2487 | |
419 | 2488 " Xquery |
2489 au BufNewFile,BufRead *.xq,*.xql,*.xqm,*.xquery,*.xqy setf xquery | |
2490 | |
7 | 2491 " XSD |
2492 au BufNewFile,BufRead *.xsd setf xsd | |
2493 | |
2494 " Xslt | |
2495 au BufNewFile,BufRead *.xsl,*.xslt setf xslt | |
2496 | |
2497 " Yacc | |
5697 | 2498 au BufNewFile,BufRead *.yy,*.yxx,*.y++ setf yacc |
375 | 2499 |
2500 " Yacc or racc | |
2501 au BufNewFile,BufRead *.y call s:FTy() | |
2502 | |
1219 | 2503 func! s:FTy() |
375 | 2504 let n = 1 |
484 | 2505 while n < 100 && n < line("$") |
2506 let line = getline(n) | |
2507 if line =~ '^\s*%' | |
2508 setf yacc | |
2509 return | |
2510 endif | |
482 | 2511 if getline(n) =~ '^\s*\(#\|class\>\)' && getline(n) !~ '^\s*#\s*include' |
375 | 2512 setf racc |
2513 return | |
2514 endif | |
2515 let n = n + 1 | |
2516 endwhile | |
2517 setf yacc | |
1219 | 2518 endfunc |
375 | 2519 |
7 | 2520 |
2521 " Yaml | |
2522 au BufNewFile,BufRead *.yaml,*.yml setf yaml | |
2523 | |
3082 | 2524 " yum conf (close enough to dosini) |
4229 | 2525 au BufNewFile,BufRead */etc/yum.conf setf dosini |
3082 | 2526 |
3513 | 2527 " Zimbu |
4229 | 2528 au BufNewFile,BufRead *.zu setf zimbu |
6421 | 2529 " Zimbu Templates |
2530 au BufNewFile,BufRead *.zut setf zimbutempl | |
3513 | 2531 |
809 | 2532 " Zope |
2533 " dtml (zope dynamic template markup language), pt (zope page template), | |
2534 " cpt (zope form controller page template) | |
826 | 2535 au BufNewFile,BufRead *.dtml,*.pt,*.cpt call s:FThtml() |
809 | 2536 " zsql (zope sql method) |
2537 au BufNewFile,BufRead *.zsql call s:SQL() | |
2538 | |
7 | 2539 " Z80 assembler asz80 |
2540 au BufNewFile,BufRead *.z8a setf z8a | |
2541 | |
2542 augroup END | |
2543 | |
2544 | |
2545 " Source the user-specified filetype file, for backwards compatibility with | |
2546 " Vim 5.x. | |
216 | 2547 if exists("myfiletypefile") && filereadable(expand(myfiletypefile)) |
7 | 2548 execute "source " . myfiletypefile |
2549 endif | |
2550 | |
2551 | |
2552 " Check for "*" after loading myfiletypefile, so that scripts.vim is only used | |
2553 " when there are no matching file name extensions. | |
2554 " Don't do this for compressed files. | |
2555 augroup filetypedetect | |
2556 au BufNewFile,BufRead * | |
2557 \ if !did_filetype() && expand("<amatch>") !~ g:ft_ignore_pat | |
2558 \ | runtime! scripts.vim | endif | |
2559 au StdinReadPost * if !did_filetype() | runtime! scripts.vim | endif | |
2560 | |
2561 | |
2562 " Extra checks for when no filetype has been detected now. Mostly used for | |
2563 " patterns that end in "*". E.g., "zsh*" matches "zsh.vim", but that's a Vim | |
2564 " script file. | |
216 | 2565 " Most of these should call s:StarSetf() to avoid names ending in .gz and the |
2566 " like are used. | |
7 | 2567 |
2751 | 2568 " More Apache config files |
2569 au BufNewFile,BufRead access.conf*,apache.conf*,apache2.conf*,httpd.conf*,srm.conf* call s:StarSetf('apache') | |
2570 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 | 2571 |
531 | 2572 " Asterisk config file |
856 | 2573 au BufNewFile,BufRead *asterisk/*.conf* call s:StarSetf('asterisk') |
794 | 2574 au BufNewFile,BufRead *asterisk*/*voicemail.conf* call s:StarSetf('asteriskvm') |
531 | 2575 |
1125 | 2576 " Bazaar version control |
2577 au BufNewFile,BufRead bzr_log.* setf bzr | |
2578 | |
7 | 2579 " BIND zone |
805 | 2580 au BufNewFile,BufRead */named/db.*,*/bind/db.* call s:StarSetf('bindzone') |
7 | 2581 |
2788 | 2582 " Calendar |
2583 au BufNewFile,BufRead */.calendar/*, | |
2584 \*/share/calendar/*/calendar.*,*/share/calendar/calendar.* | |
2585 \ call s:StarSetf('calendar') | |
2586 | |
7 | 2587 " Changelog |
216 | 2588 au BufNewFile,BufRead [cC]hange[lL]og* |
2589 \ if getline(1) =~ '; urgency=' | |
2590 \| call s:StarSetf('debchangelog') | |
2591 \|else | |
2592 \| call s:StarSetf('changelog') | |
2593 \|endif | |
7 | 2594 |
2595 " Crontab | |
2751 | 2596 au BufNewFile,BufRead crontab,crontab.*,*/etc/cron.d/* call s:StarSetf('crontab') |
816 | 2597 |
2788 | 2598 " dnsmasq(8) configuration |
2599 au BufNewFile,BufRead */etc/dnsmasq.d/* call s:StarSetf('dnsmasq') | |
2600 | |
7 | 2601 " Dracula |
216 | 2602 au BufNewFile,BufRead drac.* call s:StarSetf('dracula') |
7 | 2603 |
2604 " Fvwm | |
1125 | 2605 au BufNewFile,BufRead */.fvwm/* call s:StarSetf('fvwm') |
7 | 2606 au BufNewFile,BufRead *fvwmrc*,*fvwm95*.hook |
216 | 2607 \ let b:fvwm_version = 1 | call s:StarSetf('fvwm') |
7 | 2608 au BufNewFile,BufRead *fvwm2rc* |
216 | 2609 \ if expand("<afile>:e") == "m4" |
2610 \| call s:StarSetf('fvwm2m4') | |
2611 \|else | |
2612 \| let b:fvwm_version = 2 | call s:StarSetf('fvwm') | |
2613 \|endif | |
7 | 2614 |
2034 | 2615 " Gedcom |
2788 | 2616 au BufNewFile,BufRead */tmp/lltmp* call s:StarSetf('gedcom') |
2034 | 2617 |
7 | 2618 " GTK RC |
216 | 2619 au BufNewFile,BufRead .gtkrc*,gtkrc* call s:StarSetf('gtkrc') |
7 | 2620 |
2621 " Jam | |
216 | 2622 au BufNewFile,BufRead Prl*.*,JAM*.* call s:StarSetf('jam') |
7 | 2623 |
2624 " Jargon | |
2625 au! BufNewFile,BufRead *jarg* | |
216 | 2626 \ if getline(1).getline(2).getline(3).getline(4).getline(5) =~? 'THIS IS THE JARGON FILE' |
2627 \| call s:StarSetf('jargon') | |
2628 \|endif | |
7 | 2629 |
837 | 2630 " Kconfig |
2631 au BufNewFile,BufRead Kconfig.* call s:StarSetf('kconfig') | |
2632 | |
2788 | 2633 " Lilo: Linux loader |
2634 au BufNewFile,BufRead lilo.conf* call s:StarSetf('lilo') | |
2635 | |
2434
86532ee3ea41
Updated runtime files. Add logcheck filetype plugin. (James Vega)
Bram Moolenaar <bram@vim.org>
parents:
2415
diff
changeset
|
2636 " Logcheck |
2751 | 2637 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
|
2638 |
7 | 2639 " Makefile |
216 | 2640 au BufNewFile,BufRead [mM]akefile* call s:StarSetf('make') |
7 | 2641 |
1648 | 2642 " Ruby Makefile |
2643 au BufNewFile,BufRead [rR]akefile* call s:StarSetf('ruby') | |
2644 | |
2645 " Mail (also matches muttrc.vim, so this is below the other checks) | |
5277 | 2646 au BufNewFile,BufRead mutt[[:alnum:]._-]\\\{6\} setf mail |
1648 | 2647 |
9555
9560a5b782ee
commit https://github.com/vim/vim/commit/42ebd066422d73cdb7bda6a1dc828a3dd022dec8
Christian Brabandt <cb@256bit.org>
parents:
9533
diff
changeset
|
2648 au BufNewFile,BufRead reportbug-* call s:StarSetf('mail') |
9560a5b782ee
commit https://github.com/vim/vim/commit/42ebd066422d73cdb7bda6a1dc828a3dd022dec8
Christian Brabandt <cb@256bit.org>
parents:
9533
diff
changeset
|
2649 |
389 | 2650 " Modconf |
2788 | 2651 au BufNewFile,BufRead */etc/modutils/* |
2652 \ if executable(expand("<afile>")) != 1 | |
2653 \| call s:StarSetf('modconf') | |
2654 \|endif | |
2751 | 2655 au BufNewFile,BufRead */etc/modprobe.* call s:StarSetf('modconf') |
389 | 2656 |
7 | 2657 " Mutt setup file |
1648 | 2658 au BufNewFile,BufRead .mutt{ng,}rc*,*/.mutt{ng,}/mutt{ng,}rc* call s:StarSetf('muttrc') |
484 | 2659 au BufNewFile,BufRead mutt{ng,}rc*,Mutt{ng,}rc* call s:StarSetf('muttrc') |
7 | 2660 |
2661 " Nroff macros | |
216 | 2662 au BufNewFile,BufRead tmac.* call s:StarSetf('nroff') |
7 | 2663 |
375 | 2664 " Pam conf |
2751 | 2665 au BufNewFile,BufRead */etc/pam.d/* call s:StarSetf('pamconf') |
375 | 2666 |
7 | 2667 " Printcap and Termcap |
2668 au BufNewFile,BufRead *printcap* | |
216 | 2669 \ if !did_filetype() |
2670 \| let b:ptcap_type = "print" | call s:StarSetf('ptcap') | |
2671 \|endif | |
7 | 2672 au BufNewFile,BufRead *termcap* |
216 | 2673 \ if !did_filetype() |
2674 \| let b:ptcap_type = "term" | call s:StarSetf('ptcap') | |
2675 \|endif | |
7 | 2676 |
4278 | 2677 " ReDIF |
2678 " Only used when the .rdf file was not detected to be XML. | |
2679 au BufRead,BufNewFile *.rdf call s:Redif() | |
2680 func! s:Redif() | |
2681 let lnum = 1 | |
2682 while lnum <= 5 && lnum < line('$') | |
2683 if getline(lnum) =~ "^\ctemplate-type:" | |
2684 setf redif | |
2685 return | |
2686 endif | |
2687 let lnum = lnum + 1 | |
2688 endwhile | |
2689 endfunc | |
2690 | |
2788 | 2691 " Remind |
2692 au BufNewFile,BufRead .reminders* call s:StarSetf('remind') | |
2693 | |
7 | 2694 " Vim script |
216 | 2695 au BufNewFile,BufRead *vimrc* call s:StarSetf('vim') |
7 | 2696 |
2697 " Subversion commit file | |
45 | 2698 au BufNewFile,BufRead svn-commit*.tmp setf svn |
7 | 2699 |
2700 " X resources file | |
216 | 2701 au BufNewFile,BufRead Xresources*,*/app-defaults/*,*/Xresources/* call s:StarSetf('xdefaults') |
7 | 2702 |
2703 " XFree86 config | |
2704 au BufNewFile,BufRead XF86Config-4* | |
2751 | 2705 \ let b:xf86conf_xfree86_version = 4 | call s:StarSetf('xf86conf') |
7 | 2706 au BufNewFile,BufRead XF86Config* |
216 | 2707 \ if getline(1) =~ '\<XConfigurator\>' |
2751 | 2708 \| let b:xf86conf_xfree86_version = 3 |
216 | 2709 \|endif |
2710 \|call s:StarSetf('xf86conf') | |
7 | 2711 |
2712 " X11 xmodmap | |
216 | 2713 au BufNewFile,BufRead *xmodmap* call s:StarSetf('xmodmap') |
7 | 2714 |
375 | 2715 " Xinetd conf |
2751 | 2716 au BufNewFile,BufRead */etc/xinetd.d/* call s:StarSetf('xinetd') |
375 | 2717 |
3082 | 2718 " yum conf (close enough to dosini) |
4229 | 2719 au BufNewFile,BufRead */etc/yum.repos.d/* call s:StarSetf('dosini') |
3082 | 2720 |
7 | 2721 " Z-Shell script |
216 | 2722 au BufNewFile,BufRead zsh*,zlog* call s:StarSetf('zsh') |
7 | 2723 |
2724 | |
3237 | 2725 " Plain text files, needs to be far down to not override others. This avoids |
2726 " the "conf" type being used if there is a line starting with '#'. | |
6051 | 2727 au BufNewFile,BufRead *.txt,*.text,README setf text |
3237 | 2728 |
2013 | 2729 |
2730 " Use the filetype detect plugins. They may overrule any of the previously | |
2731 " detected filetypes. | |
2732 runtime! ftdetect/*.vim | |
2733 | |
3326 | 2734 " NOTE: The above command could have ended the filetypedetect autocmd group |
3356 | 2735 " and started another one. Let's make sure it has ended to get to a consistent |
3326 | 2736 " state. |
2737 augroup END | |
2013 | 2738 |
7 | 2739 " Generic configuration file (check this last, it's just guessing!) |
3326 | 2740 au filetypedetect BufNewFile,BufRead,StdinReadPost * |
7 | 2741 \ if !did_filetype() && expand("<amatch>") !~ g:ft_ignore_pat |
2742 \ && (getline(1) =~ '^#' || getline(2) =~ '^#' || getline(3) =~ '^#' | |
2743 \ || getline(4) =~ '^#' || getline(5) =~ '^#') | | |
2744 \ setf conf | | |
2745 \ endif | |
2746 | |
2747 | |
2748 " If the GUI is already running, may still need to install the Syntax menu. | |
2749 " Don't do it when the 'M' flag is included in 'guioptions'. | |
2750 if has("menu") && has("gui_running") | |
2751 \ && !exists("did_install_syntax_menu") && &guioptions !~# "M" | |
2752 source <sfile>:p:h/menu.vim | |
2753 endif | |
2754 | |
1219 | 2755 " Function called for testing all functions defined here. These are |
2756 " script-local, thus need to be executed here. | |
2757 " Returns a string with error messages (hopefully empty). | |
2758 func! TestFiletypeFuncs(testlist) | |
2759 let output = '' | |
2760 for f in a:testlist | |
2761 try | |
2762 exe f | |
2763 catch | |
2764 let output = output . "\n" . f . ": " . v:exception | |
2765 endtry | |
2766 endfor | |
2767 return output | |
2768 endfunc | |
2769 | |
7 | 2770 " Restore 'cpoptions' |
2771 let &cpo = s:cpo_save | |
2772 unlet s:cpo_save |