7
|
1 " Vim support file to detect file types
|
|
2 "
|
|
3 " Maintainer: Bram Moolenaar <Bram@vim.org>
|
237
|
4 " Last Change: 2005 Apr 13
|
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
|
|
19 au BufNewFile,BufRead *.orig,*.bak,*.old,*.new,*.rpmsave,*.rpmnew
|
|
20 \ exe "doau filetypedetect BufRead " . expand("<afile>:r")
|
|
21 au BufNewFile,BufRead *~
|
|
22 \ let s:name = expand("<afile>") |
|
|
23 \ let s:short = substitute(s:name, '\~$', '', '') |
|
|
24 \ if s:name != s:short && s:short != "" |
|
|
25 \ exe "doau filetypedetect BufRead " . s:short |
|
|
26 \ endif |
|
|
27 \ unlet s:name |
|
|
28 \ unlet s:short
|
|
29 au BufNewFile,BufRead *.in
|
|
30 \ if expand("<afile>:t") != "configure.in" |
|
|
31 \ exe "doau filetypedetect BufRead " . expand("<afile>:r") |
|
|
32 \ endif
|
|
33
|
|
34 " Pattern used to match file names which should not be inspected.
|
|
35 " Currently finds compressed files.
|
|
36 if !exists("g:ft_ignore_pat")
|
|
37 let g:ft_ignore_pat = '\.\(Z\|gz\|bz2\|zip\|tgz\)$'
|
|
38 endif
|
|
39
|
216
|
40 " Function used for patterns that end in a star: don't set the filetype if the
|
|
41 " file name matches ft_ignore_pat.
|
|
42 fun! s:StarSetf(ft)
|
|
43 if expand("<amatch>") !~ g:ft_ignore_pat
|
|
44 exe 'setf ' . a:ft
|
|
45 endif
|
|
46 endfun
|
|
47
|
7
|
48 " Abaqus or Trasys
|
216
|
49 au BufNewFile,BufRead *.inp call s:Check_inp()
|
7
|
50
|
216
|
51 fun! s:Check_inp()
|
7
|
52 if getline(1) =~ '^\*'
|
|
53 setf abaqus
|
|
54 else
|
|
55 let n = 1
|
|
56 if line("$") > 500
|
|
57 let nmax = 500
|
|
58 else
|
|
59 let nmax = line("$")
|
|
60 endif
|
|
61 while n <= nmax
|
|
62 if getline(n) =~? "^header surface data"
|
|
63 setf trasys
|
|
64 break
|
|
65 endif
|
|
66 let n = n + 1
|
|
67 endwhile
|
|
68 endif
|
|
69 endfun
|
|
70
|
|
71 " A-A-P recipe
|
|
72 au BufNewFile,BufRead *.aap setf aap
|
|
73
|
22
|
74 " ABAB/4
|
|
75 au BufNewFile,BufRead *.abap setf abap
|
|
76
|
7
|
77 " ABC music notation
|
|
78 au BufNewFile,BufRead *.abc setf abc
|
|
79
|
|
80 " ABEL
|
|
81 au BufNewFile,BufRead *.abl setf abel
|
|
82
|
|
83 " AceDB
|
|
84 au BufNewFile,BufRead *.wrm setf acedb
|
|
85
|
|
86 " Ada (83, 9X, 95)
|
|
87 au BufNewFile,BufRead *.adb,*.ads,*.ada setf ada
|
|
88
|
|
89 " AHDL
|
|
90 au BufNewFile,BufRead *.tdf setf ahdl
|
|
91
|
|
92 " AMPL
|
|
93 au BufNewFile,BufRead *.run setf ampl
|
|
94
|
|
95 " Ant
|
|
96 au BufNewFile,BufRead build.xml setf ant
|
|
97
|
|
98 " Apache style config file
|
216
|
99 au BufNewFile,BufRead proftpd.conf* call s:StarSetf('apachestyle')
|
7
|
100
|
|
101 " Apache config file
|
216
|
102 au BufNewFile,BufRead .htaccess setf apache
|
|
103 au BufNewFile,BufRead httpd.conf*,srm.conf*,access.conf*,apache.conf*,apache2.conf*,/etc/apache2/*.conf* call s:StarSetf('apache')
|
7
|
104
|
|
105 " XA65 MOS6510 cross assembler
|
|
106 au BufNewFile,BufRead *.a65 setf a65
|
|
107
|
|
108 " Applix ELF
|
|
109 au BufNewFile,BufRead *.am
|
|
110 \ if expand("<afile>") !~? 'Makefile.am\>' | setf elf | endif
|
|
111
|
24
|
112 " ALSA configuration
|
|
113 au BufNewFile,BufRead ~/.asoundrc,/usr/share/alsa/alsa.conf,/etc/asound.conf setf alsaconf
|
|
114
|
7
|
115 " Arc Macro Language
|
|
116 au BufNewFile,BufRead *.aml setf aml
|
|
117
|
|
118 " Arch Inventory file
|
|
119 au BufNewFile,BufRead .arch-inventory,=tagging-method setf arch
|
|
120
|
|
121 " ART*Enterprise (formerly ART-IM)
|
|
122 au BufNewFile,BufRead *.art setf art
|
|
123
|
|
124 " ASN.1
|
|
125 au BufNewFile,BufRead *.asn,*.asn1 setf asn
|
|
126
|
|
127 " Active Server Pages (with Visual Basic Script)
|
|
128 au BufNewFile,BufRead *.asa
|
|
129 \ if exists("g:filetype_asa") |
|
|
130 \ exe "setf " . g:filetype_asa |
|
|
131 \ else |
|
|
132 \ setf aspvbs |
|
|
133 \ endif
|
|
134
|
|
135 " Active Server Pages (with Perl or Visual Basic Script)
|
|
136 au BufNewFile,BufRead *.asp
|
|
137 \ if exists("g:filetype_asp") |
|
|
138 \ exe "setf " . g:filetype_asp |
|
|
139 \ elseif getline(1) . getline(2) . getline(3) =~? "perlscript" |
|
|
140 \ setf aspperl |
|
|
141 \ else |
|
|
142 \ setf aspvbs |
|
|
143 \ endif
|
|
144
|
|
145 " Grub (must be before catch *.lst)
|
|
146 au BufNewFile,BufRead /boot/grub/menu.lst,/boot/grub/grub.conf setf grub
|
|
147
|
|
148 " Assembly (all kinds)
|
|
149 " *.lst is not pure assembly, it has two extra columns (address, byte codes)
|
216
|
150 au BufNewFile,BufRead *.asm,*.[sS],*.[aA],*.mac,*.lst call s:FTasm()
|
7
|
151
|
|
152 " This function checks for the kind of assembly that is wanted by the user, or
|
|
153 " can be detected from the first five lines of the file.
|
216
|
154 fun! s:FTasm()
|
7
|
155 " make sure b:asmsyntax exists
|
|
156 if !exists("b:asmsyntax")
|
|
157 let b:asmsyntax = ""
|
|
158 endif
|
|
159
|
|
160 if b:asmsyntax == ""
|
216
|
161 call s:FTasmsyntax()
|
7
|
162 endif
|
|
163
|
|
164 " if b:asmsyntax still isn't set, default to asmsyntax or GNU
|
|
165 if b:asmsyntax == ""
|
|
166 if exists("g:asmsyntax")
|
|
167 let b:asmsyntax = g:asmsyntax
|
|
168 else
|
|
169 let b:asmsyntax = "asm"
|
|
170 endif
|
|
171 endif
|
|
172
|
|
173 exe "setf " . b:asmsyntax
|
|
174 endfun
|
|
175
|
216
|
176 fun! s:FTasmsyntax()
|
7
|
177 " see if file contains any asmsyntax=foo overrides. If so, change
|
|
178 " b:asmsyntax appropriately
|
|
179 let head = " ".getline(1)." ".getline(2)." ".getline(3)." ".getline(4).
|
|
180 \" ".getline(5)." "
|
|
181 if head =~ '\sasmsyntax=\S\+\s'
|
|
182 let b:asmsyntax = substitute(head, '.*\sasmsyntax=\(\S\+\)\s.*','\1', "")
|
|
183 elseif ((head =~? '\.title') || (head =~? '\.ident') || (head =~? '\.macro') || (head =~? '\.subtitle') || (head =~? '\.library'))
|
|
184 let b:asmsyntax = "vmasm"
|
|
185 endif
|
|
186 endfun
|
|
187
|
|
188 " Macro (VAX)
|
|
189 au BufNewFile,BufRead *.mar setf vmasm
|
|
190
|
|
191 " Atlas
|
|
192 au BufNewFile,BufRead *.atl,*.as setf atlas
|
|
193
|
|
194 " Automake
|
|
195 au BufNewFile,BufRead [mM]akefile.am setf automake
|
|
196
|
|
197 " Avenue
|
|
198 au BufNewFile,BufRead *.ave setf ave
|
|
199
|
|
200 " Awk
|
|
201 au BufNewFile,BufRead *.awk setf awk
|
|
202
|
|
203 " B
|
|
204 au BufNewFile,BufRead *.mch,*.ref,*.imp setf b
|
|
205
|
|
206 " BASIC or Visual Basic
|
216
|
207 au BufNewFile,BufRead *.bas call s:FTVB("basic")
|
7
|
208
|
|
209 " Check if one of the first five lines contains "VB_Name". In that case it is
|
|
210 " probably a Visual Basic file. Otherwise it's assumed to be "alt" filetype.
|
216
|
211 fun! s:FTVB(alt)
|
7
|
212 if getline(1).getline(2).getline(3).getline(4).getline(5) =~? 'VB_Name\|Begin VB\.\(Form\|MDIForm\|UserControl\)'
|
|
213 setf vb
|
|
214 else
|
|
215 exe "setf " . a:alt
|
|
216 endif
|
|
217 endfun
|
|
218
|
|
219 " Visual Basic Script (close to Visual Basic)
|
|
220 au BufNewFile,BufRead *.vbs,*.dsm,*.ctl setf vb
|
|
221
|
|
222 " Batch file for MSDOS.
|
15
|
223 au BufNewFile,BufRead *.bat,*.sys setf dosbatch
|
7
|
224 " *.cmd is close to a Batch file, but on OS/2 Rexx files also use *.cmd.
|
|
225 au BufNewFile,BufRead *.cmd
|
|
226 \ if getline(1) =~ '^/\*' | setf rexx | else | setf dosbatch | endif
|
|
227
|
|
228 " Batch file for 4DOS
|
216
|
229 au BufNewFile,BufRead *.btm call s:FTbtm()
|
|
230 fun! s:FTbtm()
|
15
|
231 if exists("g:dosbatch_syntax_for_btm") && g:dosbatch_syntax_for_btm
|
|
232 setf dosbatch
|
|
233 else
|
|
234 setf btm
|
|
235 endif
|
|
236 endfun
|
7
|
237
|
|
238 " BC calculator
|
|
239 au BufNewFile,BufRead *.bc setf bc
|
|
240
|
|
241 " BDF font
|
|
242 au BufNewFile,BufRead *.bdf setf bdf
|
|
243
|
|
244 " BibTeX bibliography database file
|
|
245 au BufNewFile,BufRead *.bib setf bib
|
|
246
|
|
247 " BIND configuration
|
45
|
248 au BufNewFile,BufRead named.conf,rndc.conf setf named
|
7
|
249
|
|
250 " BIND zone
|
|
251 au BufNewFile,BufRead named.root setf bindzone
|
|
252
|
|
253 " Blank
|
|
254 au BufNewFile,BufRead *.bl setf blank
|
|
255
|
|
256 " C or lpc
|
216
|
257 au BufNewFile,BufRead *.c call s:FTlpc()
|
7
|
258
|
216
|
259 fun! s:FTlpc()
|
7
|
260 if exists("g:lpc_syntax_for_c")
|
|
261 let lnum = 1
|
|
262 while lnum <= 12
|
|
263 if getline(lnum) =~# '^\(//\|inherit\|private\|protected\|nosave\|string\|object\|mapping\|mixed\)'
|
|
264 setf lpc
|
|
265 return
|
|
266 endif
|
|
267 let lnum = lnum + 1
|
|
268 endwhile
|
|
269 endif
|
|
270 setf c
|
|
271 endfun
|
|
272
|
|
273 " Calendar
|
216
|
274 au BufNewFile,BufRead calendar setf calendar
|
|
275 au BufNewFile,BufRead */.calendar/*,
|
7
|
276 \*/share/calendar/*/calendar.*,*/share/calendar/calendar.*
|
216
|
277 \ call s:StarSetf('calendar')
|
7
|
278
|
|
279 " C#
|
|
280 au BufNewFile,BufRead *.cs setf cs
|
|
281
|
|
282 " Comshare Dimension Definition Language
|
|
283 au BufNewFile,BufRead *.cdl setf cdl
|
|
284
|
|
285 " Controllable Regex Mutilator
|
|
286 au BufNewFile,BufRead *.crm setf crm
|
|
287
|
|
288 " Cyn++
|
|
289 au BufNewFile,BufRead *.cyn setf cynpp
|
|
290
|
|
291 " Cynlib
|
|
292 " .cc and .cpp files can be C++ or Cynlib.
|
|
293 au BufNewFile,BufRead *.cc
|
|
294 \ if exists("cynlib_syntax_for_cc")|setf cynlib|else|setf cpp|endif
|
|
295 au BufNewFile,BufRead *.cpp
|
|
296 \ if exists("cynlib_syntax_for_cpp")|setf cynlib|else|setf cpp|endif
|
|
297
|
|
298 " C++
|
|
299 if has("fname_case")
|
|
300 au BufNewFile,BufRead *.cxx,*.c++,*.C,*.H,*.hh,*.hxx,*.hpp,*.moc,*.tcc,*.inl setf cpp
|
|
301 else
|
|
302 au BufNewFile,BufRead *.cxx,*.c++,*.hh,*.hxx,*.hpp,*.moc,*.tcc,*.inl setf cpp
|
|
303 endif
|
|
304
|
|
305 " .h files can be C, Ch or C++, set c_syntax_for_h if you want C,
|
|
306 " ch_syntax_for_h if you want Ch.
|
|
307 au BufNewFile,BufRead *.h
|
|
308 \ if exists("c_syntax_for_h") | setf c |
|
|
309 \ elseif exists("ch_syntax_for_h") | setf ch |
|
|
310 \ else | setf cpp | endif
|
|
311
|
|
312 " Ch (CHscript)
|
|
313 au BufNewFile,BufRead *.chf setf ch
|
|
314
|
|
315 " TLH files are C++ headers generated by Visual C++'s #import from typelibs
|
|
316 au BufNewFile,BufRead *.tlh setf cpp
|
|
317
|
|
318 " Cascading Style Sheets
|
|
319 au BufNewFile,BufRead *.css setf css
|
|
320
|
|
321 " Century Term Command Scripts (*.cmd too)
|
|
322 au BufNewFile,BufRead *.con setf cterm
|
|
323
|
|
324 " Changelog
|
|
325 au BufNewFile,BufRead changelog.Debian,changelog.dch setf debchangelog
|
|
326 au BufNewFile,BufRead [cC]hange[lL]og if getline(1) =~ '; urgency='
|
|
327 \| setf debchangelog | else | setf changelog | endif
|
|
328
|
|
329 " CHILL
|
|
330 au BufNewFile,BufRead *..ch setf chill
|
|
331
|
|
332 " Changes for WEB and CWEB or CHILL
|
216
|
333 au BufNewFile,BufRead *.ch call s:FTchange()
|
7
|
334
|
|
335 " This function checks if one of the first ten lines start with a '@'. In
|
|
336 " that case it is probably a change file.
|
|
337 " If the first line starts with # or ! it's probably a ch file.
|
|
338 " If a line has "main", "include", "//" ir "/*" it's probably ch.
|
|
339 " Otherwise CHILL is assumed.
|
216
|
340 fun! s:FTchange()
|
7
|
341 let lnum = 1
|
|
342 while lnum <= 10
|
|
343 if getline(lnum)[0] == '@'
|
|
344 setf change
|
|
345 return
|
|
346 endif
|
|
347 if lnum == 1 && (getline(1)[0] == '#' || getline(1)[0] == '!')
|
|
348 setf ch
|
|
349 return
|
|
350 endif
|
|
351 if getline(lnum) =~ "MODULE"
|
|
352 setf chill
|
|
353 return
|
|
354 endif
|
|
355 if getline(lnum) =~ 'main\s*(\|#\s*include\|//'
|
|
356 setf ch
|
|
357 return
|
|
358 endif
|
|
359 let lnum = lnum + 1
|
|
360 endwhile
|
|
361 setf chill
|
|
362 endfun
|
|
363
|
|
364 " Clean
|
|
365 au BufNewFile,BufRead *.dcl,*.icl setf clean
|
|
366
|
|
367 " Clever
|
|
368 au BufNewFile,BufRead *.eni setf cl
|
|
369
|
|
370 " Clever or dtd
|
216
|
371 au BufNewFile,BufRead *.ent call s:FTent()
|
7
|
372
|
216
|
373 fun! s:FTent()
|
7
|
374 " This function checks for valid cl syntax in the first five lines.
|
|
375 " Look for either an opening comment, '#', or a block start, '{".
|
|
376 " If not found, assume SGML.
|
|
377 let lnum = 1
|
|
378 while lnum < 6
|
|
379 let line = getline(lnum)
|
|
380 if line =~ '^\s*[#{]'
|
|
381 setf cl
|
|
382 return
|
|
383 elseif line !~ '^\s*$'
|
|
384 " Not a blank line, not a comment, and not a block start,
|
|
385 " so doesn't look like valid cl code.
|
|
386 break
|
|
387 endif
|
|
388 let lnum = lnum + 1
|
|
389 endw
|
|
390 setf dtd
|
|
391 endfun
|
|
392
|
|
393 " Clipper (or FoxPro)
|
|
394 au BufNewFile,BufRead *.prg
|
|
395 \ if exists("g:filetype_prg") |
|
|
396 \ exe "setf " . g:filetype_prg |
|
|
397 \ else |
|
|
398 \ setf clipper |
|
|
399 \ endif
|
|
400
|
|
401 " Cobol
|
|
402 au BufNewFile,BufRead *.cbl,*.cob,*.cpy,*.lib setf cobol
|
|
403
|
|
404 " Cold Fusion
|
|
405 au BufNewFile,BufRead *.cfm,*.cfi,*.cfc setf cf
|
|
406
|
|
407 " Configure scripts
|
|
408 au BufNewFile,BufRead configure.in,configure.ac setf config
|
|
409
|
|
410 " WildPackets EtherPeek Decoder
|
|
411 au BufNewFile,BufRead *.dcd setf dcd
|
|
412
|
|
413 " Enlightenment configuration files
|
|
414 au BufNewFile,BufRead *enlightenment/*.cfg setf c
|
|
415
|
|
416 " Eterm
|
|
417 au BufNewFile,BufRead *Eterm/*.cfg setf eterm
|
|
418
|
|
419 " Lynx config files
|
|
420 au BufNewFile,BufRead lynx.cfg setf lynx
|
|
421
|
|
422 " Quake
|
|
423 au BufNewFile,BufRead *baseq[2-3]/*.cfg,*id1/*.cfg setf quake
|
|
424 au BufNewFile,BufRead *quake[1-3]/*.cfg setf quake
|
|
425
|
|
426 " Quake C
|
|
427 au BufNewFile,BufRead *.qc setf c
|
|
428
|
|
429 " Configure files
|
|
430 au BufNewFile,BufRead *.cfg setf cfg
|
|
431
|
|
432 " Communicating Sequential Processes
|
|
433 au BufNewFile,BufRead *.csp,*.fdr setf csp
|
|
434
|
|
435 " CUPL logic description and simulation
|
|
436 au BufNewFile,BufRead *.pld setf cupl
|
|
437 au BufNewFile,BufRead *.si setf cuplsim
|
|
438
|
|
439 " Debian Control
|
|
440 au BufNewFile,BufRead */debian/control setf debcontrol
|
|
441
|
|
442 " ROCKLinux package description
|
|
443 au BufNewFile,BufRead *.desc setf desc
|
|
444
|
|
445 " the D language
|
|
446 au BufNewFile,BufRead *.d setf d
|
|
447
|
|
448 " Desktop files
|
|
449 au BufNewFile,BufRead *.desktop,.directory setf desktop
|
|
450
|
|
451 " Diff files
|
|
452 au BufNewFile,BufRead *.diff,*.rej,*.patch setf diff
|
|
453
|
|
454 " Dircolors
|
|
455 au BufNewFile,BufRead .dir_colors,/etc/DIR_COLORS setf dircolors
|
|
456
|
|
457 " Diva (with Skill) or InstallShield
|
|
458 au BufNewFile,BufRead *.rul
|
|
459 \ if getline(1).getline(2).getline(3).getline(4).getline(5).getline(6) =~? 'InstallShield' |
|
|
460 \ setf ishd |
|
|
461 \ else |
|
|
462 \ setf diva |
|
|
463 \ endif
|
|
464
|
|
465 " DCL (Digital Command Language - vms) or DNS zone file
|
|
466 au BufNewFile,BufRead *.com
|
|
467 \ if getline(1).getline(2) =~ '$ORIGIN\|$TTL\|IN\s*SOA'
|
|
468 \ || getline(1).getline(2).getline(3).getline(4) =~ 'BIND.*named'
|
|
469 \ | setf dns | else | setf dcl | endif
|
|
470
|
|
471 " DOT
|
|
472 au BufNewFile,BufRead *.dot setf dot
|
|
473
|
|
474 " Dylan - lid files
|
|
475 au BufNewFile,BufRead *.lid setf dylanlid
|
|
476
|
|
477 " Dylan - intr files (melange)
|
|
478 au BufNewFile,BufRead *.intr setf dylanintr
|
|
479
|
|
480 " Dylan
|
|
481 au BufNewFile,BufRead *.dylan setf dylan
|
|
482
|
|
483 " Microsoft Module Definition
|
|
484 au BufNewFile,BufRead *.def setf def
|
|
485
|
|
486 " Dracula
|
|
487 au BufNewFile,BufRead *.drac,*.drc,*lvs,*lpe setf dracula
|
|
488
|
|
489 " dsl
|
|
490 au BufNewFile,BufRead *.dsl setf dsl
|
|
491
|
|
492 " DTD (Document Type Definition for XML)
|
|
493 au BufNewFile,BufRead *.dtd setf dtd
|
|
494
|
|
495 " EDIF (*.edf,*.edif,*.edn,*.edo)
|
|
496 au BufNewFile,BufRead *.ed\(f\|if\|n\|o\) setf edif
|
|
497
|
|
498 " Embedix Component Description
|
|
499 au BufNewFile,BufRead *.ecd setf ecd
|
|
500
|
|
501 " Eiffel or Specman
|
216
|
502 au BufNewFile,BufRead *.e,*.E call s:FTe()
|
7
|
503
|
|
504 " Elinks configuration
|
|
505 au BufNewFile,BufRead */etc/elinks.conf,*/.elinks/elinks.conf setf elinks
|
|
506
|
216
|
507 fun! s:FTe()
|
7
|
508 let n = 1
|
|
509 while n < 100 && n < line("$")
|
|
510 if getline(n) =~ "^\\s*\\(<'\\|'>\\)\\s*$"
|
|
511 setf specman
|
|
512 return
|
|
513 endif
|
|
514 let n = n + 1
|
|
515 endwhile
|
|
516 setf eiffel
|
|
517 endfun
|
|
518
|
|
519 " ERicsson LANGuage
|
|
520 au BufNewFile,BufRead *.erl setf erlang
|
|
521
|
|
522 " Elm Filter Rules file
|
|
523 au BufNewFile,BufRead filter-rules setf elmfilt
|
|
524
|
168
|
525 " ESMTP rc file
|
|
526 au BufNewFile,BufRead *esmtprc setf esmtprc
|
|
527
|
7
|
528 " ESQL-C
|
|
529 au BufNewFile,BufRead *.ec,*.EC setf esqlc
|
|
530
|
|
531 " Essbase script
|
|
532 au BufNewFile,BufRead *.csc setf csc
|
|
533
|
|
534 " Exim
|
|
535 au BufNewFile,BufRead exim.conf setf exim
|
|
536
|
|
537 " Expect
|
|
538 au BufNewFile,BufRead *.exp setf expect
|
|
539
|
|
540 " Exports
|
|
541 au BufNewFile,BufRead exports setf exports
|
|
542
|
|
543 " Fetchmail RC file
|
|
544 au BufNewFile,BufRead .fetchmailrc setf fetchmail
|
|
545
|
|
546 " Focus Executable
|
|
547 au BufNewFile,BufRead *.fex,*.focexec setf focexec
|
|
548
|
|
549 " Focus Master file (but not for auto.master)
|
|
550 au BufNewFile,BufRead auto.master setf conf
|
|
551 au BufNewFile,BufRead *.mas,*.master setf master
|
|
552
|
|
553 " Forth
|
|
554 au BufNewFile,BufRead *.fs,*.ft setf forth
|
|
555
|
|
556 " Fortran
|
148
|
557 au BufNewFile,BufRead *.f,*.F,*.for,*.fpp,*.FPP*.ftn,*.f77,*.F77,*.f90,*.F90,*.f95,*.F95 setf fortran
|
7
|
558
|
|
559 " FStab
|
|
560 au BufNewFile,BufRead fstab setf fstab
|
|
561
|
|
562 " GDB command files
|
|
563 au BufNewFile,BufRead .gdbinit setf gdb
|
|
564
|
|
565 " GDMO
|
|
566 au BufNewFile,BufRead *.mo,*.gdmo setf gdmo
|
|
567
|
|
568 " Gedcom
|
|
569 au BufNewFile,BufRead *.ged setf gedcom
|
|
570
|
|
571 " Gkrellmrc
|
|
572 au BufNewFile,BufRead gkrellmrc,gkrellmrc_? setf gkrellmrc
|
|
573
|
|
574 " GP scripts (2.0 and onward)
|
|
575 au BufNewFile,BufRead *.gp setf gp
|
|
576
|
|
577 " GPG
|
|
578 au BufNewFile,BufRead */.gnupg/options setf gpg
|
|
579 au BufNewFile,BufRead */.gnupg/gpg.conf setf gpg
|
|
580 au BufNewFile,BufRead /usr/**/gnupg/options.skel setf gpg
|
|
581
|
|
582 " Gnuplot scripts
|
|
583 au BufNewFile,BufRead *.gpi setf gnuplot
|
|
584
|
|
585 " GrADS scripts
|
|
586 au BufNewFile,BufRead *.gs setf grads
|
|
587
|
|
588 " Groovy
|
|
589 au BufNewFile,BufRead *.groovy setf groovy
|
|
590
|
|
591 " GNU Server Pages
|
|
592 au BufNewFile,BufRead *.gsp setf gsp
|
|
593
|
|
594 " GTK RC
|
|
595 au BufNewFile,BufRead .gtkrc,gtkrc setf gtkrc
|
|
596
|
|
597 " Haskell
|
|
598 au BufNewFile,BufRead *.hs setf haskell
|
|
599 au BufNewFile,BufRead *.lhs setf lhaskell
|
|
600 au BufNewFile,BufRead *.chs setf chaskell
|
|
601
|
|
602 " Hercules
|
|
603 au BufNewFile,BufRead *.vc,*.ev,*.rs,*.sum,*.errsum setf hercules
|
|
604
|
|
605 " HEX (Intel)
|
|
606 au BufNewFile,BufRead *.hex,*.h32 setf hex
|
|
607
|
|
608 " Tilde (must be before HTML)
|
|
609 au BufNewFile,BufRead *.t.html setf tilde
|
|
610
|
133
|
611 " HTML (.shtml and .stm for server side, .rhtml for Ruby html)
|
216
|
612 au BufNewFile,BufRead *.html,*.htm,*.shtml,*.rhtml,*.stm call s:FThtml()
|
7
|
613
|
|
614 " Distinguish between HTML and XHTML
|
216
|
615 fun! s:FThtml()
|
7
|
616 let n = 1
|
|
617 while n < 10 && n < line("$")
|
|
618 if getline(n) =~ '\<DTD\s\+XHTML\s'
|
|
619 setf xhtml
|
|
620 return
|
|
621 endif
|
|
622 let n = n + 1
|
|
623 endwhile
|
|
624 setf html
|
|
625 endfun
|
|
626
|
|
627
|
|
628 " HTML with M4
|
|
629 au BufNewFile,BufRead *.html.m4 setf htmlm4
|
|
630
|
|
631 " HTML Cheetah template
|
|
632 au BufNewFile,BufRead *.tmpl setf htmlcheetah
|
|
633
|
|
634 " Hyper Builder
|
|
635 au BufNewFile,BufRead *.hb setf hb
|
|
636
|
|
637 " Icon
|
|
638 au BufNewFile,BufRead *.icn setf icon
|
|
639
|
|
640 " IDL (Interface Description Language)
|
216
|
641 au BufNewFile,BufRead *.idl call s:FTidl()
|
7
|
642
|
|
643 " Distinguish between standard IDL and MS-IDL
|
216
|
644 fun! s:FTidl()
|
7
|
645 let n = 1
|
|
646 while n < 50 && n < line("$")
|
|
647 if getline(n) =~ '^\s*import\s\+"\(unknwn\|objidl\)\.idl"'
|
|
648 setf msidl
|
|
649 return
|
|
650 endif
|
|
651 let n = n + 1
|
|
652 endwhile
|
|
653 setf idl
|
|
654 endfun
|
|
655
|
|
656 " Microsoft IDL (Interface Description Language) Also *.idl
|
|
657 " MOF = WMI (Windows Management Instrumentation) Managed Object Format
|
|
658 au BufNewFile,BufRead *.odl,*.mof setf msidl
|
|
659
|
|
660 " Icewm menu
|
|
661 au BufNewFile,BufRead */.icewm/menu setf icemenu
|
|
662
|
|
663 " IDL (Interactive Data Language)
|
|
664 au BufNewFile,BufRead *.pro setf idlang
|
|
665
|
|
666 " Inform
|
148
|
667 au BufNewFile,BufRead .indent.pro setf indent
|
|
668
|
|
669 " Inform
|
7
|
670 au BufNewFile,BufRead *.inf,*.INF setf inform
|
|
671
|
148
|
672 " Ipfilter
|
|
673 au BufNewFile,BufRead ipf.conf,ipf.rules setf ipfilter
|
|
674
|
7
|
675 " Informix 4GL (source - canonical, include file, I4GL+M4 preproc.)
|
|
676 au BufNewFile,BufRead *.4gl,*.4gh,*.m4gl setf fgl
|
|
677
|
|
678 " .INI file for MSDOS
|
|
679 au BufNewFile,BufRead *.ini setf dosini
|
|
680
|
|
681 " SysV Inittab
|
|
682 au BufNewFile,BufRead inittab setf inittab
|
|
683
|
|
684 " Inno Setup
|
|
685 au BufNewFile,BufRead *.iss setf iss
|
|
686
|
|
687 " JAL
|
|
688 au BufNewFile,BufRead *.jal,*.JAL setf jal
|
|
689
|
|
690 " Jam
|
|
691 au BufNewFile,BufRead *.jpl,*.jpr setf jam
|
|
692
|
|
693 " Java
|
|
694 au BufNewFile,BufRead *.java,*.jav setf java
|
|
695
|
|
696 " JavaCC
|
|
697 au BufNewFile,BufRead *.jj,*.jjt setf javacc
|
|
698
|
|
699 " JavaScript
|
|
700 au BufNewFile,BufRead *.js,*.javascript setf javascript
|
|
701
|
|
702 " Java Server Pages
|
|
703 au BufNewFile,BufRead *.jsp setf jsp
|
|
704
|
|
705 " Java Properties resource file (note: doesn't catch font.properties.pl)
|
216
|
706 au BufNewFile,BufRead *.properties,*.properties_??,*.properties_??_?? setf jproperties
|
|
707 au BufNewFile,BufRead *.properties_??_??_* call s:StarSetf('jproperties')
|
7
|
708
|
|
709 " Jess
|
|
710 au BufNewFile,BufRead *.clp setf jess
|
|
711
|
|
712 " Jgraph
|
|
713 au BufNewFile,BufRead *.jgr setf jgraph
|
|
714
|
|
715 " Kixtart
|
|
716 au BufNewFile,BufRead *.kix setf kix
|
|
717
|
|
718 " Kimwitu[++]
|
|
719 au BufNewFile,BufRead *.k setf kwt
|
|
720
|
|
721 " KDE script
|
|
722 au BufNewFile,BufRead *.ks setf kscript
|
|
723
|
|
724 " Lace (ISE)
|
|
725 au BufNewFile,BufRead *.ace,*.ACE setf lace
|
|
726
|
|
727 " Latte
|
|
728 au BufNewFile,BufRead *.latte,*.lte setf latte
|
|
729
|
|
730 " LambdaProlog (*.mod too, see Modsim)
|
|
731 au BufNewFile,BufRead *.sig setf lprolog
|
|
732
|
|
733 " LDAP LDIF
|
|
734 au BufNewFile,BufRead *.ldif setf ldif
|
|
735
|
|
736 " Lex
|
|
737 au BufNewFile,BufRead *.lex,*.l setf lex
|
|
738
|
|
739 " Libao
|
|
740 au BufNewFile,BufRead /etc/libao.conf,*/.libao setf libao
|
|
741
|
|
742 " LFTP
|
|
743 au BufNewFile,BufRead lftp.conf,.lftprc,*lftp/rc setf lftp
|
|
744
|
|
745 " Lifelines (or Lex for C++!)
|
|
746 au BufNewFile,BufRead *.ll setf lifelines
|
|
747
|
|
748 " Lilo: Linux loader
|
216
|
749 au BufNewFile,BufRead lilo.conf* call s:StarSetf('lilo')
|
7
|
750
|
|
751 " Lisp (*.el = ELisp, *.cl = Common Lisp, *.jl = librep Lisp)
|
|
752 if has("fname_case")
|
|
753 au BufNewFile,BufRead *.lsp,*.lisp,*.el,*.cl,*.jl,*.L,.emacs,.sawfishrc setf lisp
|
|
754 else
|
|
755 au BufNewFile,BufRead *.lsp,*.lisp,*.el,*.cl,*.jl,.emacs,.sawfishrc setf lisp
|
|
756 endif
|
|
757
|
|
758 " Lite
|
|
759 au BufNewFile,BufRead *.lite,*.lt setf lite
|
|
760
|
|
761 " Logtalk
|
|
762 au BufNewFile,BufRead *.lgt setf logtalk
|
|
763
|
|
764 " LOTOS
|
|
765 au BufNewFile,BufRead *.lot,*.lotos setf lotos
|
|
766
|
|
767 " Lout (also: *.lt)
|
|
768 au BufNewFile,BufRead *.lou,*.lout setf lout
|
|
769
|
|
770 " Lua
|
|
771 au BufNewFile,BufRead *.lua setf lua
|
|
772
|
|
773 " Lynx style file (or LotusScript!)
|
|
774 au BufNewFile,BufRead *.lss setf lss
|
|
775
|
|
776 " M4
|
|
777 au BufNewFile,BufRead *.m4
|
|
778 \ if expand("<afile>") !~? 'html.m4$\|fvwm2rc' | setf m4 | endif
|
|
779
|
|
780 " MaGic Point
|
|
781 au BufNewFile,BufRead *.mgp setf mgp
|
|
782
|
|
783 " Mail (for Elm, trn, mutt, rn, slrn)
|
|
784 au BufNewFile,BufRead snd.\d\+,.letter,.letter.\d\+,.followup,.article,.article.\d\+,pico.\d\+,mutt-*-\w\+,mutt\w\{6\},ae\d\+.txt,/tmp/SLRN[0-9A-Z.]\+,*.eml setf mail
|
|
785
|
|
786 " Mailcap configuration file
|
|
787 au BufNewFile,BufRead .mailcap,mailcap setf mailcap
|
|
788
|
|
789 " Makefile
|
|
790 au BufNewFile,BufRead *[mM]akefile,*.mk,*.mak,*.dsp setf make
|
|
791
|
|
792 " MakeIndex
|
|
793 au BufNewFile,BufRead *.ist,*.mst setf ist
|
|
794
|
|
795 " Manpage
|
|
796 au BufNewFile,BufRead *.man setf man
|
|
797
|
|
798 " Maple V
|
|
799 au BufNewFile,BufRead *.mv,*.mpl,*.mws setf maple
|
|
800
|
|
801 " Mason
|
|
802 au BufNewFile,BufRead *.mason,*.mhtml setf mason
|
|
803
|
|
804 " Matlab or Objective C
|
216
|
805 au BufNewFile,BufRead *.m call s:FTm()
|
7
|
806
|
216
|
807 fun! s:FTm()
|
7
|
808 let n = 1
|
|
809 while n < 10
|
|
810 let line = getline(n)
|
|
811 if line =~ '^\s*\(#\s*\(include\|import\)\>\|/\*\)'
|
|
812 setf objc
|
|
813 return
|
|
814 endif
|
|
815 if line =~ '^\s*%'
|
|
816 setf matlab
|
|
817 return
|
|
818 endif
|
|
819 if line =~ '^\s*(\*'
|
|
820 setf mma
|
|
821 return
|
|
822 endif
|
|
823 let n = n + 1
|
|
824 endwhile
|
|
825 setf matlab
|
|
826 endfun
|
|
827
|
|
828 " Maya Extension Language
|
|
829 au BufNewFile,BufRead *.mel setf mel
|
|
830
|
|
831 " Metafont
|
|
832 au BufNewFile,BufRead *.mf setf mf
|
|
833
|
|
834 " MetaPost
|
|
835 au BufNewFile,BufRead *.mp setf mp
|
|
836
|
|
837 " MMIX or VMS makefile
|
216
|
838 au BufNewFile,BufRead *.mms call s:FTmms()
|
7
|
839
|
216
|
840 fun! s:FTmms()
|
7
|
841 let n = 1
|
|
842 while n < 10
|
|
843 let line = getline(n)
|
|
844 if line =~ '^\s*\(%\|//\)' || line =~ '^\*'
|
|
845 setf mmix
|
|
846 return
|
|
847 endif
|
|
848 if line =~ '^\s*#'
|
|
849 setf make
|
|
850 return
|
|
851 endif
|
|
852 let n = n + 1
|
|
853 endwhile
|
|
854 setf mmix
|
|
855 endfun
|
|
856
|
|
857
|
|
858 " Modsim III (or LambdaProlog)
|
|
859 au BufNewFile,BufRead *.mod
|
|
860 \ if getline(1) =~ '\<module\>' |
|
|
861 \ setf lprolog |
|
|
862 \ else |
|
|
863 \ setf modsim3 |
|
|
864 \ endif
|
|
865
|
|
866 " Modula 2
|
|
867 au BufNewFile,BufRead *.m2,*.DEF,*.MOD,*.md,*.mi setf modula2
|
|
868
|
|
869 " Modula 3 (.m3, .i3, .mg, .ig)
|
|
870 au BufNewFile,BufRead *.[mi][3g] setf modula3
|
|
871
|
|
872 " Monk
|
|
873 au BufNewFile,BufRead *.isc,*.monk,*.ssc,*.tsc setf monk
|
|
874
|
|
875 " MOO
|
|
876 au BufNewFile,BufRead *.moo setf moo
|
|
877
|
|
878 " Modconf
|
|
879 au BufNewFile,BufRead /etc/modules.conf,/etc/conf.modules setf modconf
|
|
880 au BufNewFile,BufRead /etc/modutils/*
|
216
|
881 \ if executable(expand("<afile>")) != 1
|
|
882 \| call s:StarSetf('modconf')
|
|
883 \|endif
|
7
|
884
|
|
885 " Mplayer config
|
|
886 au BufNewFile,BufRead mplayer.conf,*/.mplayer/config setf mplayerconf
|
|
887
|
|
888 " Moterola S record
|
|
889 au BufNewFile,BufRead *.s19,*.s28,*.s37 setf srec
|
|
890
|
|
891 " Msql
|
|
892 au BufNewFile,BufRead *.msql setf msql
|
|
893
|
|
894 " Mysql
|
|
895 au BufNewFile,BufRead *.mysql setf mysql
|
|
896
|
|
897 " M$ Resource files
|
|
898 au BufNewFile,BufRead *.rc setf rc
|
|
899
|
12
|
900 " MuPAD source
|
|
901 au BufRead,BufNewFile *.mu setf mupad
|
|
902
|
7
|
903 " Mush
|
|
904 au BufNewFile,BufRead *.mush setf mush
|
|
905
|
|
906 " Mutt setup file
|
216
|
907 au BufNewFile,BufRead Muttrc setf muttrc
|
|
908 au BufNewFile,BufRead .muttrc*,*/.mutt/muttrc* call s:StarSetf('muttrc')
|
7
|
909
|
|
910 " Nastran input/DMAP
|
|
911 "au BufNewFile,BufRead *.dat setf nastran
|
|
912
|
|
913 " Natural
|
|
914 au BufNewFile,BufRead *.NS[ACGLMNPS] setf natural
|
|
915
|
39
|
916 " Netrc
|
|
917 au BufNewFile,BufRead .netrc setf netrc
|
|
918
|
7
|
919 " Novell netware batch files
|
|
920 au BufNewFile,BufRead *.ncf setf ncf
|
|
921
|
|
922 " Nroff/Troff (*.ms and *.t are checked below)
|
|
923 au BufNewFile,BufRead *.me
|
|
924 \ if expand("<afile>") != "read.me" && expand("<afile>") != "click.me" |
|
|
925 \ setf nroff |
|
|
926 \ endif
|
|
927 au BufNewFile,BufRead *.tr,*.nr,*.roff,*.tmac,*.mom setf nroff
|
216
|
928 au BufNewFile,BufRead *.[1-9] call s:FTnroff()
|
7
|
929
|
|
930 " This function checks if one of the first five lines start with a dot. In
|
|
931 " that case it is probably an nroff file: 'filetype' is set and 1 is returned.
|
216
|
932 fun! s:FTnroff()
|
7
|
933 if getline(1)[0] . getline(2)[0] . getline(3)[0] . getline(4)[0] . getline(5)[0] =~ '\.'
|
|
934 setf nroff
|
|
935 return 1
|
|
936 endif
|
|
937 return 0
|
|
938 endfun
|
|
939
|
|
940 " Nroff or Objective C++
|
216
|
941 au BufNewFile,BufRead *.mm call s:FTmm()
|
7
|
942
|
216
|
943 fun! s:FTmm()
|
7
|
944 let n = 1
|
|
945 while n < 10
|
|
946 let line = getline(n)
|
|
947 if line =~ '^\s*\(#\s*\(include\|import\)\>\|/\*\)'
|
|
948 setf objcpp
|
|
949 return
|
|
950 endif
|
|
951 let n = n + 1
|
|
952 endwhile
|
|
953 setf nroff
|
|
954 endfun
|
|
955
|
|
956 " Not Quite C
|
|
957 au BufNewFile,BufRead *.nqc setf nqc
|
|
958
|
|
959 " NSIS
|
|
960 au BufNewFile,BufRead *.nsi setf nsis
|
|
961
|
|
962 " OCAML
|
|
963 au BufNewFile,BufRead *.ml,*.mli,*.mll,*.mly setf ocaml
|
|
964
|
|
965 " Occam
|
|
966 au BufNewFile,BufRead *.occ setf occam
|
|
967
|
|
968 " Omnimark
|
|
969 au BufNewFile,BufRead *.xom,*.xin setf omnimark
|
|
970
|
|
971 " OpenROAD
|
|
972 au BufNewFile,BufRead *.or setf openroad
|
|
973
|
|
974 " OPL
|
|
975 au BufNewFile,BufRead *.[Oo][Pp][Ll] setf opl
|
|
976
|
|
977 " Oracle config file
|
|
978 au BufNewFile,BufRead *.ora setf ora
|
|
979
|
|
980 " Packet filter conf
|
|
981 au BufNewFile,BufRead pf.conf setf pf
|
|
982
|
|
983 " PApp
|
|
984 au BufNewFile,BufRead *.papp,*.pxml,*.pxsl setf papp
|
|
985
|
|
986 " Pascal (also *.p)
|
|
987 au BufNewFile,BufRead *.pas setf pascal
|
|
988
|
|
989 " Delphi project file
|
|
990 au BufNewFile,BufRead *.dpr setf pascal
|
|
991
|
|
992 " Perl
|
|
993 if has("fname_case")
|
216
|
994 au BufNewFile,BufRead *.pl,*.PL call s:FTpl()
|
7
|
995 else
|
216
|
996 au BufNewFile,BufRead *.pl call s:FTpl()
|
7
|
997 endif
|
11
|
998 au BufNewFile,BufRead *.plx setf perl
|
7
|
999
|
216
|
1000 fun! s:FTpl()
|
7
|
1001 if exists("g:filetype_pl")
|
|
1002 exe "setf " . g:filetype_pl
|
|
1003 else
|
|
1004 " recognize Prolog by specific text in the first non-empty line
|
|
1005 " require a blank after the '%' because Perl uses "%list" and "%translate"
|
|
1006 let l = getline(nextnonblank(1))
|
|
1007 if l =~ '\<prolog\>' || l =~ '^\s*\(%\+\(\s\|$\)\|/\*\)' || l =~ ':-'
|
|
1008 setf prolog
|
|
1009 else
|
|
1010 setf perl
|
|
1011 endif
|
|
1012 endif
|
|
1013 endfun
|
|
1014
|
|
1015 " Perl, XPM or XPM2
|
|
1016 au BufNewFile,BufRead *.pm
|
|
1017 \ if getline(1) =~ "XPM2" |
|
|
1018 \ setf xpm2 |
|
|
1019 \ elseif getline(1) =~ "XPM" |
|
|
1020 \ setf xpm |
|
|
1021 \ else |
|
|
1022 \ setf perl |
|
|
1023 \ endif
|
|
1024
|
|
1025 " Perl POD
|
|
1026 au BufNewFile,BufRead *.pod setf pod
|
|
1027
|
|
1028 " Php3
|
|
1029 au BufNewFile,BufRead *.php,*.php3 setf php
|
|
1030
|
|
1031 " Phtml
|
|
1032 au BufNewFile,BufRead *.phtml setf phtml
|
|
1033
|
|
1034 " Pike
|
|
1035 au BufNewFile,BufRead *.pike,*.lpc,*.ulpc,*.pmod setf pike
|
|
1036
|
|
1037 " Pinfo config
|
|
1038 au BufNewFile,BufRead */etc/pinforc,*/.pinforc setf pinfo
|
|
1039
|
|
1040 " Palm Resource compiler
|
|
1041 au BufNewFile,BufRead *.rcp setf pilrc
|
|
1042
|
|
1043 " Pine config
|
|
1044 au BufNewFile,BufRead .pinerc,pinerc,.pinercex,pinercex setf pine
|
|
1045
|
|
1046 " PL/M (also: *.inp)
|
|
1047 au BufNewFile,BufRead *.plm,*.p36,*.pac setf plm
|
|
1048
|
|
1049 " PL/SQL
|
|
1050 au BufNewFile,BufRead *.pls,*.plsql setf plsql
|
|
1051
|
|
1052 " PLP
|
|
1053 au BufNewFile,BufRead *.plp setf plp
|
|
1054
|
|
1055 " PO and PO template (GNU gettext)
|
|
1056 au BufNewFile,BufRead *.po,*.pot setf po
|
|
1057
|
|
1058 " Postfix main config
|
|
1059 au BufNewFile,BufRead main.cf setf pfmain
|
|
1060
|
|
1061 " PostScript (+ font files, encapsulated PostScript, Adobe Illustrator)
|
|
1062 au BufNewFile,BufRead *.ps,*.pfa,*.afm,*.eps,*.epsf,*.epsi,*.ai setf postscr
|
|
1063
|
|
1064 " PostScript Printer Description
|
|
1065 au BufNewFile,BufRead *.ppd setf ppd
|
|
1066
|
|
1067 " Povray
|
|
1068 au BufNewFile,BufRead *.pov setf pov
|
|
1069
|
|
1070 " Povray configuration
|
|
1071 au BufNewFile,BufRead .povrayrc setf povini
|
|
1072
|
|
1073 " Povray, PHP or assembly
|
216
|
1074 au BufNewFile,BufRead *.inc call s:FTinc()
|
7
|
1075
|
216
|
1076 fun! s:FTinc()
|
7
|
1077 if exists("g:filetype_inc")
|
|
1078 exe "setf " . g:filetype_inc
|
|
1079 else
|
|
1080 let lines = getline(1).getline(2).getline(3)
|
|
1081 if lines =~? "perlscript"
|
|
1082 setf aspperl
|
|
1083 elseif lines =~ "<%"
|
|
1084 setf aspvbs
|
|
1085 elseif lines =~ "<?"
|
|
1086 setf php
|
|
1087 else
|
216
|
1088 call s:FTasmsyntax()
|
7
|
1089 if exists("b:asmsyntax")
|
|
1090 exe "setf " . b:asmsyntax
|
|
1091 else
|
|
1092 setf pov
|
|
1093 endif
|
|
1094 endif
|
|
1095 endif
|
|
1096 endfun
|
|
1097
|
|
1098 " Printcap and Termcap
|
|
1099 au BufNewFile,BufRead *printcap
|
|
1100 \ let b:ptcap_type = "print" | setf ptcap
|
|
1101 au BufNewFile,BufRead *termcap
|
|
1102 \ let b:ptcap_type = "term" | setf ptcap
|
|
1103
|
|
1104 " PCCTS / ANTRL
|
|
1105 "au BufNewFile,BufRead *.g setf antrl
|
|
1106 au BufNewFile,BufRead *.g setf pccts
|
|
1107
|
|
1108 " PPWizard
|
|
1109 au BufNewFile,BufRead *.it,*.ih setf ppwiz
|
|
1110
|
|
1111 " Oracle Pro*C/C++
|
|
1112 au BufNewFile,BufRead .pc setf proc
|
|
1113
|
|
1114 " Procmail
|
|
1115 au BufNewFile,BufRead .procmail,.procmailrc setf procmail
|
|
1116
|
|
1117 " Progress or CWEB
|
216
|
1118 au BufNewFile,BufRead *.w call s:FTprogress_cweb()
|
7
|
1119
|
216
|
1120 function! s:FTprogress_cweb()
|
7
|
1121 if exists("g:filetype_w")
|
|
1122 exe "setf " . g:filetype_w
|
|
1123 return
|
|
1124 endif
|
|
1125 if getline(1) =~ '&ANALYZE' || getline(3) =~ '&GLOBAL-DEFINE'
|
|
1126 setf progress
|
|
1127 else
|
|
1128 setf cweb
|
|
1129 endif
|
|
1130 endfun
|
|
1131
|
|
1132 " Progress or assembly
|
216
|
1133 au BufNewFile,BufRead *.i call s:FTprogress_asm()
|
7
|
1134
|
216
|
1135 function! s:FTprogress_asm()
|
7
|
1136 if exists("g:filetype_i")
|
|
1137 exe "setf " . g:filetype_i
|
|
1138 return
|
|
1139 endif
|
|
1140 " This function checks for an assembly comment the first ten lines.
|
|
1141 " If not found, assume Progress.
|
|
1142 let lnum = 1
|
|
1143 while lnum <= 10
|
|
1144 let line = getline(lnum)
|
|
1145 if line =~ '^\s*;' || line =~ '^\*'
|
216
|
1146 call s:FTasm()
|
7
|
1147 return
|
|
1148 elseif line !~ '^\s*$' || line =~ '^/\*'
|
|
1149 " Not an empty line: Doesn't look like valid assembly code.
|
|
1150 " Or it looks like a Progress /* comment
|
|
1151 break
|
|
1152 endif
|
|
1153 let lnum = lnum + 1
|
|
1154 endw
|
|
1155 setf progress
|
|
1156 endfun
|
|
1157
|
|
1158 " Progress or Pascal
|
216
|
1159 au BufNewFile,BufRead *.p call s:FTprogress_pascal()
|
7
|
1160
|
216
|
1161 function! s:FTprogress_pascal()
|
7
|
1162 if exists("g:filetype_p")
|
|
1163 exe "setf " . g:filetype_p
|
|
1164 return
|
|
1165 endif
|
|
1166 " This function checks for valid Pascal syntax in the first ten lines.
|
|
1167 " Look for either an opening comment or a program start.
|
|
1168 " If not found, assume Progress.
|
|
1169 let lnum = 1
|
|
1170 while lnum <= 10
|
|
1171 let line = getline(lnum)
|
|
1172 if line =~ '^\s*\(program\|procedure\|function\|const\|type\|var\)\>'
|
|
1173 \ || line =~ '^\s*{' || line =~ '^\s*(\*'
|
|
1174 setf pascal
|
|
1175 return
|
|
1176 elseif line !~ '^\s*$' || line =~ '^/\*'
|
|
1177 " Not an empty line: Doesn't look like valid Pascal code.
|
|
1178 " Or it looks like a Progress /* comment
|
|
1179 break
|
|
1180 endif
|
|
1181 let lnum = lnum + 1
|
|
1182 endw
|
|
1183 setf progress
|
|
1184 endfun
|
|
1185
|
|
1186
|
|
1187 " Software Distributor Product Specification File (POSIX 1387.2-1995)
|
|
1188 au BufNewFile,BufRead *.psf setf psf
|
|
1189 au BufNewFile,BufRead INDEX,INFO
|
|
1190 \ if getline(1) =~ '^\s*\(distribution\|installed_software\|root\|bundle\|product\)\s*$' |
|
|
1191 \ setf psf |
|
|
1192 \ endif
|
|
1193
|
|
1194 " Prolog
|
|
1195 au BufNewFile,BufRead *.pdb setf prolog
|
|
1196
|
|
1197 " Pyrex
|
|
1198 au BufNewFile,BufRead *.pyx,*.pxd setf pyrex
|
|
1199
|
|
1200 " Python
|
|
1201 au BufNewFile,BufRead *.py,*.pyw setf python
|
|
1202
|
|
1203 " Radiance
|
|
1204 au BufNewFile,BufRead *.rad,*.mat setf radiance
|
|
1205
|
|
1206 " Ratpoison config/command files
|
|
1207 au BufNewFile,BufRead .ratpoisonrc,ratpoisonrc setf ratpoison
|
|
1208
|
|
1209 " RCS file
|
|
1210 au BufNewFile,BufRead *\,v setf rcs
|
|
1211
|
|
1212 " Readline
|
237
|
1213 au BufNewFile,BufRead .inputrc,inputrc setf readline
|
7
|
1214
|
|
1215 " Registry for MS-Windows
|
|
1216 au BufNewFile,BufRead *.reg
|
|
1217 \ if getline(1) =~? '^REGEDIT[0-9]*\s*$\|^Windows Registry Editor Version \d*\.\d*\s*$' | setf registry | endif
|
|
1218
|
|
1219 " Renderman Interface Bytestream
|
|
1220 au BufNewFile,BufRead *.rib setf rib
|
|
1221
|
|
1222 " Rexx
|
|
1223 au BufNewFile,BufRead *.rexx,*.rex setf rexx
|
|
1224
|
|
1225 " R (Splus)
|
|
1226 au BufNewFile,BufRead *.s,*.S setf r
|
|
1227
|
|
1228 " Rexx, Rebol or R
|
216
|
1229 au BufNewFile,BufRead *.r,*.R call s:FTr()
|
7
|
1230
|
216
|
1231 fun! s:FTr()
|
7
|
1232 if getline(1) =~ '^REBOL'
|
|
1233 setf rebol
|
|
1234 else
|
|
1235 let n = 1
|
|
1236 let max = line("$")
|
|
1237 if max > 50
|
|
1238 let max = 50
|
|
1239 endif
|
|
1240 while n < max
|
|
1241 " R has # comments
|
|
1242 if getline(n) =~ '^\s*#'
|
|
1243 setf r
|
|
1244 break
|
|
1245 endif
|
|
1246 " Rexx has /* comments */
|
|
1247 if getline(n) =~ '^\s*/\*'
|
|
1248 setf rexx
|
|
1249 break
|
|
1250 endif
|
|
1251 let n = n + 1
|
|
1252 endwhile
|
|
1253 if n >= max
|
|
1254 setf rexx
|
|
1255 endif
|
|
1256 endif
|
|
1257 endfun
|
|
1258
|
|
1259 " Remind
|
216
|
1260 au BufNewFile,BufRead .reminders* call s:StarSetf('remind')
|
7
|
1261
|
|
1262 " Resolv.conf
|
|
1263 au BufNewFile,BufRead resolv.conf setf resolv
|
|
1264
|
|
1265 " Relax NG Compact
|
|
1266 au BufNewFile,BufRead *.rnc setf rnc
|
|
1267
|
|
1268 " RPL/2
|
|
1269 au BufNewFile,BufRead *.rpl setf rpl
|
|
1270
|
|
1271 " Robots.txt
|
|
1272 au BufNewFile,BufRead robots.txt setf robots
|
|
1273
|
|
1274 " Rpcgen
|
|
1275 au BufNewFile,BufRead *.x setf rpcgen
|
|
1276
|
|
1277 " reStructuredText Documentation Format
|
|
1278 au BufNewFile,BufRead *.rst setf rst
|
|
1279
|
|
1280 " RTF
|
|
1281 au BufNewFile,BufRead *.rtf setf rtf
|
|
1282
|
|
1283 " Ruby
|
|
1284 au BufNewFile,BufRead *.rb,*.rbw,*.gem,*.gemspec setf ruby
|
|
1285
|
|
1286 " S-lang (or shader language!)
|
|
1287 au BufNewFile,BufRead *.sl setf slang
|
|
1288
|
|
1289 " Samba config
|
|
1290 au BufNewFile,BufRead smb.conf setf samba
|
|
1291
|
|
1292 " SAS script
|
|
1293 au BufNewFile,BufRead *.sas setf sas
|
|
1294
|
|
1295 " Sather
|
|
1296 au BufNewFile,BufRead *.sa setf sather
|
|
1297
|
|
1298 " Scilab
|
|
1299 au BufNewFile,BufRead *.sci setf scilab
|
|
1300
|
|
1301 " SDL
|
|
1302 au BufNewFile,BufRead *.sdl,*.pr setf sdl
|
|
1303
|
|
1304 " sed
|
|
1305 au BufNewFile,BufRead *.sed setf sed
|
|
1306
|
36
|
1307 " Sieve (RFC 3028)
|
|
1308 au BufNewFile,BufRead *.siv setf sieve
|
|
1309
|
7
|
1310 " Sendmail
|
|
1311 au BufNewFile,BufRead sendmail.cf setf sm
|
|
1312
|
|
1313 " Sendmail .mc files are actually m4
|
|
1314 au BufNewFile,BufRead *.mc setf m4
|
|
1315
|
|
1316 " SGML
|
|
1317 au BufNewFile,BufRead *.sgm,*.sgml
|
|
1318 \ if getline(1).getline(2).getline(3).getline(4).getline(5) =~? 'linuxdoc' |
|
|
1319 \ setf sgmllnx |
|
|
1320 \ elseif getline(1) =~ '<!DOCTYPE.*DocBook' || getline(2) =~ '<!DOCTYPE.*DocBook' |
|
|
1321 \ let b:docbk_type="sgml" |
|
|
1322 \ setf docbk |
|
|
1323 \ else |
|
|
1324 \ setf sgml |
|
|
1325 \ endif
|
|
1326
|
|
1327 " SGMLDECL
|
|
1328 au BufNewFile,BufRead *.decl,*.dcl,*.dec
|
|
1329 \ if getline(1).getline(2).getline(3) =~? '^<!SGML' |
|
|
1330 \ setf sgmldecl |
|
|
1331 \ endif
|
|
1332
|
|
1333 " SGML catalog file
|
216
|
1334 au BufNewFile,BufRead catalog setf catalog
|
|
1335 au BufNewFile,BufRead sgml.catalog* call s:StarSetf('catalog')
|
7
|
1336
|
|
1337 " Shell scripts (sh, ksh, bash, bash2, csh); Allow .profile_foo etc.
|
|
1338 " Gentoo ebuilds are actually bash scripts
|
|
1339 au BufNewFile,BufRead .bashrc*,bashrc,bash.bashrc,.bash_profile*,.bash_logout*,*.bash,*.ebuild call SetFileTypeSH("bash")
|
|
1340 au BufNewFile,BufRead .kshrc*,*.ksh call SetFileTypeSH("ksh")
|
|
1341 au BufNewFile,BufRead /etc/profile,.profile*,*.sh,*.env call SetFileTypeSH(getline(1))
|
|
1342
|
216
|
1343 " Also called from scripts.vim.
|
7
|
1344 fun! SetFileTypeSH(name)
|
216
|
1345 if expand("<amatch>") =~ g:ft_ignore_pat
|
|
1346 return
|
|
1347 endif
|
7
|
1348 if a:name =~ '\<ksh\>'
|
|
1349 let b:is_kornshell = 1
|
|
1350 if exists("b:is_bash")
|
|
1351 unlet b:is_bash
|
|
1352 endif
|
|
1353 if exists("b:is_sh")
|
|
1354 unlet b:is_sh
|
|
1355 endif
|
|
1356 elseif exists("g:bash_is_sh") || a:name =~ '\<bash\>' || a:name =~ '\<bash2\>'
|
|
1357 let b:is_bash = 1
|
|
1358 if exists("b:is_kornshell")
|
|
1359 unlet b:is_kornshell
|
|
1360 endif
|
|
1361 if exists("b:is_sh")
|
|
1362 unlet b:is_sh
|
|
1363 endif
|
|
1364 elseif a:name =~ '\<sh\>'
|
|
1365 let b:is_sh = 1
|
|
1366 if exists("b:is_kornshell")
|
|
1367 unlet b:is_kornshell
|
|
1368 endif
|
|
1369 if exists("b:is_bash")
|
|
1370 unlet b:is_bash
|
|
1371 endif
|
|
1372 endif
|
26
|
1373 call SetFileTypeShell("sh")
|
|
1374 endfun
|
|
1375
|
|
1376 " For shell-like file types, check for an "exec" command hidden in a comment,
|
|
1377 " as used for Tcl.
|
216
|
1378 " Also called from scripts.vim, thus can't be local to this script.
|
26
|
1379 fun! SetFileTypeShell(name)
|
216
|
1380 if expand("<amatch>") =~ g:ft_ignore_pat
|
|
1381 return
|
|
1382 endif
|
26
|
1383 let l = 2
|
|
1384 while l < 20 && l < line("$") && getline(l) =~ '^\s*\(#\|$\)'
|
|
1385 " Skip empty and comment lines.
|
|
1386 let l = l + 1
|
|
1387 endwhile
|
|
1388 if l < line("$") && getline(l) =~ '\s*exec\s' && getline(l - 1) =~ '^\s*#.*\\$'
|
|
1389 " Found an "exec" line after a comment with continuation
|
|
1390 let n = substitute(getline(l),'\s*exec\s\+\([^ ]*/\)\=', '', '')
|
|
1391 if n =~ '\<tclsh\|\<wish'
|
|
1392 setf tcl
|
|
1393 return
|
|
1394 endif
|
|
1395 endif
|
|
1396 exe "setf " . a:name
|
7
|
1397 endfun
|
|
1398
|
|
1399 " tcsh scripts
|
26
|
1400 au BufNewFile,BufRead .tcshrc*,*.tcsh,tcsh.tcshrc,tcsh.login call SetFileTypeShell("tcsh")
|
7
|
1401
|
|
1402 " csh scripts, but might also be tcsh scripts (on some systems csh is tcsh)
|
216
|
1403 au BufNewFile,BufRead .login*,.cshrc*,csh.cshrc,csh.login,csh.logout,*.csh,.alias call s:CSH()
|
7
|
1404
|
216
|
1405 fun! s:CSH()
|
7
|
1406 if exists("g:filetype_csh")
|
26
|
1407 call SetFileTypeShell(g:filetype_csh)
|
7
|
1408 elseif &shell =~ "tcsh"
|
26
|
1409 call SetFileTypeShell("tcsh")
|
7
|
1410 else
|
26
|
1411 call SetFileTypeShell("csh")
|
7
|
1412 endif
|
|
1413 endfun
|
|
1414
|
|
1415 " Z-Shell script
|
216
|
1416 au BufNewFile,BufRead .zprofile,/etc/zprofile,.zfbfmarks setf zsh
|
|
1417 au BufNewFile,BufRead .zsh*,.zlog*,.zcompdump* call s:StarSetf('zsh')
|
7
|
1418
|
|
1419 " Scheme
|
|
1420 au BufNewFile,BufRead *.scm,*.ss setf scheme
|
|
1421
|
|
1422 " Screen RC
|
|
1423 au BufNewFile,BufRead .screenrc,screenrc setf screen
|
|
1424
|
|
1425 " Simula
|
|
1426 au BufNewFile,BufRead *.sim setf simula
|
|
1427
|
|
1428 " SINDA
|
|
1429 au BufNewFile,BufRead *.sin,*.s85 setf sinda
|
|
1430
|
|
1431 " SKILL
|
|
1432 au BufNewFile,BufRead *.il setf skill
|
|
1433
|
|
1434 " SLRN
|
|
1435 au BufNewFile,BufRead .slrnrc setf slrnrc
|
|
1436 au BufNewFile,BufRead *.score setf slrnsc
|
|
1437
|
|
1438 " Smalltalk
|
|
1439 au BufNewFile,BufRead *.st,*.cls setf st
|
|
1440
|
|
1441 " Smarty templates
|
|
1442 au BufNewFile,BufRead *.tpl setf smarty
|
|
1443
|
|
1444 " SMIL or XML
|
|
1445 au BufNewFile,BufRead *.smil
|
|
1446 \ if getline(1) =~ '<?\s*xml.*?>' |
|
|
1447 \ setf xml |
|
|
1448 \ else |
|
|
1449 \ setf smil |
|
|
1450 \ endif
|
|
1451
|
|
1452 " SMIL or SNMP MIB file
|
|
1453 au BufNewFile,BufRead *.smi
|
|
1454 \ if getline(1) =~ '\<smil\>' |
|
|
1455 \ setf smil |
|
|
1456 \ else |
|
|
1457 \ setf mib |
|
|
1458 \ endif
|
|
1459
|
|
1460 " SMITH
|
|
1461 au BufNewFile,BufRead *.smt,*.smith setf smith
|
|
1462
|
|
1463 " Snobol4
|
|
1464 au BufNewFile,BufRead *.sno setf snobol4
|
|
1465
|
|
1466 " SNMP MIB files
|
|
1467 au BufNewFile,BufRead *.mib,*.my setf mib
|
|
1468
|
|
1469 " Snort Configuration
|
|
1470 au BufNewFile,BufRead *.hog,snort.conf,vision.conf,*.rules setf hog
|
|
1471
|
|
1472 " Spec (Linux RPM)
|
|
1473 au BufNewFile,BufRead *.spec setf spec
|
|
1474
|
|
1475 " Speedup (AspenTech plant simulator)
|
|
1476 au BufNewFile,BufRead *.speedup,*.spdata,*.spd setf spup
|
|
1477
|
|
1478 " Slice
|
|
1479 au BufNewFile,BufRead *.ice setf slice
|
|
1480
|
|
1481 " Spice
|
|
1482 au BufNewFile,BufRead *.sp,*.spice setf spice
|
|
1483
|
|
1484 " Spyce
|
|
1485 au BufNewFile,BufRead *.spy,*.spi setf spyce
|
|
1486
|
|
1487 " Squid
|
|
1488 au BufNewFile,BufRead squid.conf setf squid
|
|
1489
|
22
|
1490 " SQL for Oracle Designer
|
|
1491 au BufNewFile,BufRead *.tyb,*.typ,*.tyc,*.pkb,*.pks setf sql
|
|
1492
|
|
1493 " SQL
|
216
|
1494 au BufNewFile,BufRead *.sql call s:SQL()
|
22
|
1495
|
216
|
1496 fun! s:SQL()
|
22
|
1497 if exists("g:filetype_sql")
|
|
1498 exe "setf " . g:filetype_sql
|
|
1499 else
|
|
1500 setf sql
|
|
1501 endif
|
|
1502 endfun
|
7
|
1503
|
|
1504 " SQLJ
|
|
1505 au BufNewFile,BufRead *.sqlj setf sqlj
|
|
1506
|
|
1507 " SQR
|
|
1508 au BufNewFile,BufRead *.sqr,*.sqi setf sqr
|
|
1509
|
|
1510 " OpenSSH configuration
|
|
1511 au BufNewFile,BufRead ssh_config,*/.ssh/config setf sshconfig
|
|
1512
|
|
1513 " OpenSSH server configuration
|
|
1514 au BufNewFile,BufRead sshd_config setf sshdconfig
|
|
1515
|
|
1516 " Stored Procedures
|
|
1517 au BufNewFile,BufRead *.stp setf stp
|
|
1518
|
|
1519 " Standard ML
|
|
1520 au BufNewFile,BufRead *.sml setf sml
|
|
1521
|
39
|
1522 " Sudoers
|
|
1523 au BufNewFile,BufRead /etc/sudoers,sudoers.tmp setf sudoers
|
|
1524
|
7
|
1525 " Tads (or Nroff)
|
|
1526 au BufNewFile,BufRead *.t
|
216
|
1527 \ if !s:FTnroff() | setf tads | endif
|
7
|
1528
|
|
1529 " Tags
|
|
1530 au BufNewFile,BufRead tags setf tags
|
|
1531
|
|
1532 " TAK
|
|
1533 au BufNewFile,BufRead *.tak setf tak
|
|
1534
|
|
1535 " Tcl
|
|
1536 au BufNewFile,BufRead *.tcl,*.tk,*.itcl,*.itk setf tcl
|
|
1537
|
|
1538 " TealInfo
|
|
1539 au BufNewFile,BufRead *.tli setf tli
|
|
1540
|
|
1541 " Telix Salt
|
|
1542 au BufNewFile,BufRead *.slt setf tsalt
|
|
1543
|
|
1544 " Terminfo
|
|
1545 au BufNewFile,BufRead *.ti setf terminfo
|
|
1546
|
|
1547 " TeX
|
|
1548 au BufNewFile,BufRead *.tex,*.latex,*.sty,*.dtx,*.ltx,*.bbl setf tex
|
|
1549
|
|
1550 " Texinfo
|
|
1551 au BufNewFile,BufRead *.texinfo,*.texi,*.txi setf texinfo
|
|
1552
|
|
1553 " TeX configuration
|
|
1554 au BufNewFile,BufRead texmf.cnf setf texmf
|
|
1555
|
|
1556 " Tidy config
|
|
1557 au BufNewFile,BufRead .tidyrc,tidyrc setf tidy
|
|
1558
|
|
1559 " TF mud client
|
|
1560 au BufNewFile,BufRead *.tf,.tfrc,tfrc setf tf
|
|
1561
|
33
|
1562 " TPP - Text Presentation Program
|
|
1563 au BufNewFile,BufReadPost *.tpp setf tpp
|
|
1564
|
7
|
1565 " TSS - Geometry
|
|
1566 au BufNewFile,BufReadPost *.tssgm setf tssgm
|
|
1567
|
|
1568 " TSS - Optics
|
|
1569 au BufNewFile,BufReadPost *.tssop setf tssop
|
|
1570
|
|
1571 " TSS - Command Line (temporary)
|
|
1572 au BufNewFile,BufReadPost *.tsscl setf tsscl
|
|
1573
|
|
1574 " Motif UIT/UIL files
|
|
1575 au BufNewFile,BufRead *.uit,*.uil setf uil
|
|
1576
|
|
1577 " UnrealScript
|
|
1578 au BufNewFile,BufRead *.uc setf uc
|
|
1579
|
|
1580 " Verilog HDL
|
|
1581 au BufNewFile,BufRead *.v setf verilog
|
|
1582
|
|
1583 " VHDL
|
216
|
1584 au BufNewFile,BufRead *.hdl,*.vhd,*.vhdl,*.vbe,*.vst setf vhdl
|
|
1585 au BufNewFile,BufRead *.vhdl_[0-9]* call s:StarSetf('vhdl')
|
7
|
1586
|
|
1587 " Vim script
|
|
1588 au BufNewFile,BufRead *.vim,.exrc,_exrc setf vim
|
|
1589
|
|
1590 " Viminfo file
|
|
1591 au BufNewFile,BufRead .viminfo,_viminfo setf viminfo
|
|
1592
|
|
1593 " Virata Config Script File
|
|
1594 au BufRead,BufNewFile *.hw,*.module,*.pkg setf virata
|
|
1595
|
|
1596 " Visual Basic (also uses *.bas) or FORM
|
216
|
1597 au BufNewFile,BufRead *.frm call s:FTVB("form")
|
7
|
1598
|
|
1599 " SaxBasic is close to Visual Basic
|
|
1600 au BufNewFile,BufRead *.sba setf vb
|
|
1601
|
|
1602 " Vgrindefs file
|
|
1603 au BufNewFile,BufRead vgrindefs setf vgrindefs
|
|
1604
|
|
1605 " VRML V1.0c
|
|
1606 au BufNewFile,BufRead *.wrl setf vrml
|
|
1607
|
|
1608 " Webmacro
|
|
1609 au BufNewFile,BufRead *.wm setf webmacro
|
|
1610
|
|
1611 " Wget config
|
|
1612 au BufNewFile,BufRead .wgetrc,wgetrc setf wget
|
|
1613
|
|
1614 " Website MetaLanguage
|
|
1615 au BufNewFile,BufRead *.wml setf wml
|
|
1616
|
|
1617 " Winbatch
|
|
1618 au BufNewFile,BufRead *.wbt setf winbatch
|
|
1619
|
|
1620 " WvDial
|
|
1621 au BufNewFile,BufRead wvdial.conf,.wvdialrc setf wvdial
|
|
1622
|
|
1623 " CVS RC file
|
|
1624 au BufNewFile,BufRead .cvsrc setf cvsrc
|
|
1625
|
|
1626 " CVS commit file
|
|
1627 au BufNewFile,BufRead cvs\d\+ setf cvs
|
|
1628
|
|
1629 " WEB (*.web is also used for Winbatch: Guess, based on expecting "%" comment
|
|
1630 " lines in a WEB file).
|
|
1631 au BufNewFile,BufRead *.web
|
|
1632 \ if getline(1)[0].getline(2)[0].getline(3)[0].getline(4)[0].getline(5)[0] =~ "%" |
|
|
1633 \ setf web |
|
|
1634 \ else |
|
|
1635 \ setf winbatch |
|
|
1636 \ endif
|
|
1637
|
|
1638 " Windows Scripting Host and Windows Script Component
|
|
1639 au BufNewFile,BufRead *.ws[fc] setf wsh
|
|
1640
|
|
1641 " X Pixmap (dynamically sets colors, use BufEnter to make it work better)
|
|
1642 au BufEnter *.xpm
|
|
1643 \ if getline(1) =~ "XPM2" |
|
|
1644 \ setf xpm2 |
|
|
1645 \ else |
|
|
1646 \ setf xpm |
|
|
1647 \ endif
|
|
1648 au BufEnter *.xpm2 setf xpm2
|
|
1649
|
|
1650 " XFree86 config
|
|
1651 au BufNewFile,BufRead XF86Config
|
|
1652 \ if getline(1) =~ '\<XConfigurator\>' |
|
|
1653 \ let b:xf86c_xfree86_version = 3 |
|
|
1654 \ endif |
|
|
1655 \ setf xf86conf
|
|
1656
|
|
1657 " Xorg config
|
|
1658 au BufNewFile,BufRead xorg.conf,xorg.conf-4 let b:xf86c_xfree86_version = 4 | setf xf86conf
|
|
1659
|
|
1660 " XS Perl extension interface language
|
|
1661 au BufNewFile,BufRead *.xs setf xs
|
|
1662
|
|
1663 " X resources file
|
|
1664 au BufNewFile,BufRead .Xdefaults,.Xpdefaults,.Xresources,xdm-config,*.ad setf xdefaults
|
|
1665
|
|
1666 " Xmath
|
|
1667 au BufNewFile,BufRead *.msc,*.msf setf xmath
|
|
1668 au BufNewFile,BufRead *.ms
|
216
|
1669 \ if !s:FTnroff() | setf xmath | endif
|
7
|
1670
|
|
1671 " XML
|
|
1672 au BufNewFile,BufRead *.xml
|
|
1673 \ if getline(1) . getline(2) . getline(3) =~ '<!DOCTYPE.*DocBook' |
|
|
1674 \ let b:docbk_type="xml" |
|
|
1675 \ setf docbk |
|
|
1676 \ else |
|
|
1677 \ setf xml |
|
|
1678 \ endif
|
|
1679
|
|
1680 " XMI (holding UML models) is also XML
|
|
1681 au BufNewFile,BufRead *.xmi setf xml
|
|
1682
|
|
1683 " CSPROJ files are Visual Studio.NET's XML-based project config files
|
|
1684 au BufNewFile,BufRead *.csproj,*.csproj.user setf xml
|
|
1685
|
|
1686 " Qt Linguist translation source and Qt User Interface Files are XML
|
|
1687 au BufNewFile,BufRead *.ts,*.ui setf xml
|
|
1688
|
|
1689 " XSD
|
|
1690 au BufNewFile,BufRead *.xsd setf xsd
|
|
1691
|
|
1692 " Xslt
|
|
1693 au BufNewFile,BufRead *.xsl,*.xslt setf xslt
|
|
1694
|
|
1695 " Yacc
|
|
1696 au BufNewFile,BufRead *.y,*.yy setf yacc
|
|
1697
|
|
1698 " Yaml
|
|
1699 au BufNewFile,BufRead *.yaml,*.yml setf yaml
|
|
1700
|
|
1701 " Z80 assembler asz80
|
|
1702 au BufNewFile,BufRead *.z8a setf z8a
|
|
1703
|
|
1704 augroup END
|
|
1705
|
|
1706
|
|
1707 " Source the user-specified filetype file, for backwards compatibility with
|
|
1708 " Vim 5.x.
|
216
|
1709 if exists("myfiletypefile") && filereadable(expand(myfiletypefile))
|
7
|
1710 execute "source " . myfiletypefile
|
|
1711 endif
|
|
1712
|
|
1713
|
|
1714 " Check for "*" after loading myfiletypefile, so that scripts.vim is only used
|
|
1715 " when there are no matching file name extensions.
|
|
1716 " Don't do this for compressed files.
|
|
1717 augroup filetypedetect
|
|
1718 au BufNewFile,BufRead *
|
|
1719 \ if !did_filetype() && expand("<amatch>") !~ g:ft_ignore_pat
|
|
1720 \ | runtime! scripts.vim | endif
|
|
1721 au StdinReadPost * if !did_filetype() | runtime! scripts.vim | endif
|
|
1722
|
|
1723
|
|
1724 " Extra checks for when no filetype has been detected now. Mostly used for
|
|
1725 " patterns that end in "*". E.g., "zsh*" matches "zsh.vim", but that's a Vim
|
|
1726 " script file.
|
216
|
1727 " Most of these should call s:StarSetf() to avoid names ending in .gz and the
|
|
1728 " like are used.
|
7
|
1729
|
|
1730 " BIND zone
|
216
|
1731 au BufNewFile,BufRead /var/named/* call s:StarSetf('bindzone')
|
7
|
1732
|
|
1733 " Changelog
|
216
|
1734 au BufNewFile,BufRead [cC]hange[lL]og*
|
|
1735 \ if getline(1) =~ '; urgency='
|
|
1736 \| call s:StarSetf('debchangelog')
|
|
1737 \|else
|
|
1738 \| call s:StarSetf('changelog')
|
|
1739 \|endif
|
7
|
1740
|
|
1741 " Crontab
|
216
|
1742 au BufNewFile,BufRead crontab,crontab.* call s:StarSetf('crontab')
|
7
|
1743
|
|
1744 " Dracula
|
216
|
1745 au BufNewFile,BufRead drac.* call s:StarSetf('dracula')
|
7
|
1746
|
|
1747 " Fvwm
|
|
1748 au BufNewFile,BufRead *fvwmrc*,*fvwm95*.hook
|
216
|
1749 \ let b:fvwm_version = 1 | call s:StarSetf('fvwm')
|
7
|
1750 au BufNewFile,BufRead *fvwm2rc*
|
216
|
1751 \ if expand("<afile>:e") == "m4"
|
|
1752 \| call s:StarSetf('fvwm2m4')
|
|
1753 \|else
|
|
1754 \| let b:fvwm_version = 2 | call s:StarSetf('fvwm')
|
|
1755 \|endif
|
7
|
1756
|
|
1757 " GTK RC
|
216
|
1758 au BufNewFile,BufRead .gtkrc*,gtkrc* call s:StarSetf('gtkrc')
|
7
|
1759
|
|
1760 " Jam
|
216
|
1761 au BufNewFile,BufRead Prl*.*,JAM*.* call s:StarSetf('jam')
|
7
|
1762
|
|
1763 " Jargon
|
|
1764 au! BufNewFile,BufRead *jarg*
|
216
|
1765 \ if getline(1).getline(2).getline(3).getline(4).getline(5) =~? 'THIS IS THE JARGON FILE'
|
|
1766 \| call s:StarSetf('jargon')
|
|
1767 \|endif
|
7
|
1768
|
|
1769 " Makefile
|
216
|
1770 au BufNewFile,BufRead [mM]akefile* call s:StarSetf('make')
|
7
|
1771
|
|
1772 " Ruby Makefile
|
216
|
1773 au BufNewFile,BufRead [rR]akefile* call s:StarSetf('ruby')
|
7
|
1774
|
|
1775 " Mutt setup file
|
216
|
1776 au BufNewFile,BufRead muttrc*,Muttrc* call s:StarSetf('muttrc')
|
7
|
1777
|
|
1778 " Nroff macros
|
216
|
1779 au BufNewFile,BufRead tmac.* call s:StarSetf('nroff')
|
7
|
1780
|
|
1781 " Printcap and Termcap
|
|
1782 au BufNewFile,BufRead *printcap*
|
216
|
1783 \ if !did_filetype()
|
|
1784 \| let b:ptcap_type = "print" | call s:StarSetf('ptcap')
|
|
1785 \|endif
|
7
|
1786 au BufNewFile,BufRead *termcap*
|
216
|
1787 \ if !did_filetype()
|
|
1788 \| let b:ptcap_type = "term" | call s:StarSetf('ptcap')
|
|
1789 \|endif
|
7
|
1790
|
|
1791 " Vim script
|
216
|
1792 au BufNewFile,BufRead *vimrc* call s:StarSetf('vim')
|
7
|
1793
|
|
1794 " Subversion commit file
|
45
|
1795 au BufNewFile,BufRead svn-commit*.tmp setf svn
|
7
|
1796
|
|
1797 " X resources file
|
216
|
1798 au BufNewFile,BufRead Xresources*,*/app-defaults/*,*/Xresources/* call s:StarSetf('xdefaults')
|
7
|
1799
|
|
1800 " XFree86 config
|
|
1801 au BufNewFile,BufRead XF86Config-4*
|
216
|
1802 \ let b:xf86c_xfree86_version = 4 | call s:StarSetf('xf86conf')
|
7
|
1803 au BufNewFile,BufRead XF86Config*
|
216
|
1804 \ if getline(1) =~ '\<XConfigurator\>'
|
|
1805 \| let b:xf86c_xfree86_version = 3
|
|
1806 \|endif
|
|
1807 \|call s:StarSetf('xf86conf')
|
7
|
1808
|
|
1809 " X11 xmodmap
|
216
|
1810 au BufNewFile,BufRead *xmodmap* call s:StarSetf('xmodmap')
|
7
|
1811
|
|
1812 " Z-Shell script
|
216
|
1813 au BufNewFile,BufRead zsh*,zlog* call s:StarSetf('zsh')
|
7
|
1814
|
|
1815
|
|
1816 " Generic configuration file (check this last, it's just guessing!)
|
|
1817 au BufNewFile,BufRead,StdinReadPost *
|
|
1818 \ if !did_filetype() && expand("<amatch>") !~ g:ft_ignore_pat
|
|
1819 \ && (getline(1) =~ '^#' || getline(2) =~ '^#' || getline(3) =~ '^#'
|
|
1820 \ || getline(4) =~ '^#' || getline(5) =~ '^#') |
|
|
1821 \ setf conf |
|
|
1822 \ endif
|
|
1823
|
|
1824 " Use the plugin-filetype checks last, they may overrule any of the previously
|
|
1825 " detected filetypes.
|
|
1826 runtime! ftdetect/*.vim
|
|
1827
|
|
1828 augroup END
|
|
1829
|
|
1830
|
|
1831 " If the GUI is already running, may still need to install the Syntax menu.
|
|
1832 " Don't do it when the 'M' flag is included in 'guioptions'.
|
|
1833 if has("menu") && has("gui_running")
|
|
1834 \ && !exists("did_install_syntax_menu") && &guioptions !~# "M"
|
|
1835 source <sfile>:p:h/menu.vim
|
|
1836 endif
|
|
1837
|
|
1838 " Restore 'cpoptions'
|
|
1839 let &cpo = s:cpo_save
|
|
1840 unlet s:cpo_save
|