7
|
1 " Vim support file to detect file types
|
|
2 "
|
|
3 " Maintainer: Bram Moolenaar <Bram@vim.org>
|
278
|
4 " Last Change: 2005 May 20
|
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
|
278
|
531 " Esterel
|
|
532 au BufNewFile,BufRead *.strl setf esterel
|
|
533
|
7
|
534 " Essbase script
|
|
535 au BufNewFile,BufRead *.csc setf csc
|
|
536
|
|
537 " Exim
|
|
538 au BufNewFile,BufRead exim.conf setf exim
|
|
539
|
|
540 " Expect
|
|
541 au BufNewFile,BufRead *.exp setf expect
|
|
542
|
|
543 " Exports
|
|
544 au BufNewFile,BufRead exports setf exports
|
|
545
|
|
546 " Fetchmail RC file
|
|
547 au BufNewFile,BufRead .fetchmailrc setf fetchmail
|
|
548
|
|
549 " Focus Executable
|
|
550 au BufNewFile,BufRead *.fex,*.focexec setf focexec
|
|
551
|
|
552 " Focus Master file (but not for auto.master)
|
|
553 au BufNewFile,BufRead auto.master setf conf
|
|
554 au BufNewFile,BufRead *.mas,*.master setf master
|
|
555
|
|
556 " Forth
|
|
557 au BufNewFile,BufRead *.fs,*.ft setf forth
|
|
558
|
|
559 " Fortran
|
148
|
560 au BufNewFile,BufRead *.f,*.F,*.for,*.fpp,*.FPP*.ftn,*.f77,*.F77,*.f90,*.F90,*.f95,*.F95 setf fortran
|
7
|
561
|
|
562 " FStab
|
|
563 au BufNewFile,BufRead fstab setf fstab
|
|
564
|
|
565 " GDB command files
|
|
566 au BufNewFile,BufRead .gdbinit setf gdb
|
|
567
|
|
568 " GDMO
|
|
569 au BufNewFile,BufRead *.mo,*.gdmo setf gdmo
|
|
570
|
|
571 " Gedcom
|
|
572 au BufNewFile,BufRead *.ged setf gedcom
|
|
573
|
|
574 " Gkrellmrc
|
|
575 au BufNewFile,BufRead gkrellmrc,gkrellmrc_? setf gkrellmrc
|
|
576
|
|
577 " GP scripts (2.0 and onward)
|
|
578 au BufNewFile,BufRead *.gp setf gp
|
|
579
|
|
580 " GPG
|
|
581 au BufNewFile,BufRead */.gnupg/options setf gpg
|
|
582 au BufNewFile,BufRead */.gnupg/gpg.conf setf gpg
|
|
583 au BufNewFile,BufRead /usr/**/gnupg/options.skel setf gpg
|
|
584
|
|
585 " Gnuplot scripts
|
|
586 au BufNewFile,BufRead *.gpi setf gnuplot
|
|
587
|
|
588 " GrADS scripts
|
|
589 au BufNewFile,BufRead *.gs setf grads
|
|
590
|
|
591 " Groovy
|
|
592 au BufNewFile,BufRead *.groovy setf groovy
|
|
593
|
|
594 " GNU Server Pages
|
|
595 au BufNewFile,BufRead *.gsp setf gsp
|
|
596
|
|
597 " GTK RC
|
|
598 au BufNewFile,BufRead .gtkrc,gtkrc setf gtkrc
|
|
599
|
|
600 " Haskell
|
|
601 au BufNewFile,BufRead *.hs setf haskell
|
|
602 au BufNewFile,BufRead *.lhs setf lhaskell
|
|
603 au BufNewFile,BufRead *.chs setf chaskell
|
|
604
|
|
605 " Hercules
|
|
606 au BufNewFile,BufRead *.vc,*.ev,*.rs,*.sum,*.errsum setf hercules
|
|
607
|
|
608 " HEX (Intel)
|
|
609 au BufNewFile,BufRead *.hex,*.h32 setf hex
|
|
610
|
|
611 " Tilde (must be before HTML)
|
|
612 au BufNewFile,BufRead *.t.html setf tilde
|
|
613
|
133
|
614 " HTML (.shtml and .stm for server side, .rhtml for Ruby html)
|
216
|
615 au BufNewFile,BufRead *.html,*.htm,*.shtml,*.rhtml,*.stm call s:FThtml()
|
7
|
616
|
|
617 " Distinguish between HTML and XHTML
|
216
|
618 fun! s:FThtml()
|
7
|
619 let n = 1
|
|
620 while n < 10 && n < line("$")
|
|
621 if getline(n) =~ '\<DTD\s\+XHTML\s'
|
|
622 setf xhtml
|
|
623 return
|
|
624 endif
|
|
625 let n = n + 1
|
|
626 endwhile
|
|
627 setf html
|
|
628 endfun
|
|
629
|
|
630
|
|
631 " HTML with M4
|
|
632 au BufNewFile,BufRead *.html.m4 setf htmlm4
|
|
633
|
|
634 " HTML Cheetah template
|
|
635 au BufNewFile,BufRead *.tmpl setf htmlcheetah
|
|
636
|
|
637 " Hyper Builder
|
|
638 au BufNewFile,BufRead *.hb setf hb
|
|
639
|
|
640 " Icon
|
|
641 au BufNewFile,BufRead *.icn setf icon
|
|
642
|
|
643 " IDL (Interface Description Language)
|
216
|
644 au BufNewFile,BufRead *.idl call s:FTidl()
|
7
|
645
|
|
646 " Distinguish between standard IDL and MS-IDL
|
216
|
647 fun! s:FTidl()
|
7
|
648 let n = 1
|
|
649 while n < 50 && n < line("$")
|
|
650 if getline(n) =~ '^\s*import\s\+"\(unknwn\|objidl\)\.idl"'
|
|
651 setf msidl
|
|
652 return
|
|
653 endif
|
|
654 let n = n + 1
|
|
655 endwhile
|
|
656 setf idl
|
|
657 endfun
|
|
658
|
|
659 " Microsoft IDL (Interface Description Language) Also *.idl
|
|
660 " MOF = WMI (Windows Management Instrumentation) Managed Object Format
|
|
661 au BufNewFile,BufRead *.odl,*.mof setf msidl
|
|
662
|
|
663 " Icewm menu
|
|
664 au BufNewFile,BufRead */.icewm/menu setf icemenu
|
|
665
|
|
666 " IDL (Interactive Data Language)
|
|
667 au BufNewFile,BufRead *.pro setf idlang
|
|
668
|
|
669 " Inform
|
148
|
670 au BufNewFile,BufRead .indent.pro setf indent
|
|
671
|
|
672 " Inform
|
7
|
673 au BufNewFile,BufRead *.inf,*.INF setf inform
|
|
674
|
148
|
675 " Ipfilter
|
|
676 au BufNewFile,BufRead ipf.conf,ipf.rules setf ipfilter
|
|
677
|
7
|
678 " Informix 4GL (source - canonical, include file, I4GL+M4 preproc.)
|
|
679 au BufNewFile,BufRead *.4gl,*.4gh,*.m4gl setf fgl
|
|
680
|
|
681 " .INI file for MSDOS
|
|
682 au BufNewFile,BufRead *.ini setf dosini
|
|
683
|
|
684 " SysV Inittab
|
|
685 au BufNewFile,BufRead inittab setf inittab
|
|
686
|
|
687 " Inno Setup
|
|
688 au BufNewFile,BufRead *.iss setf iss
|
|
689
|
|
690 " JAL
|
|
691 au BufNewFile,BufRead *.jal,*.JAL setf jal
|
|
692
|
|
693 " Jam
|
|
694 au BufNewFile,BufRead *.jpl,*.jpr setf jam
|
|
695
|
|
696 " Java
|
|
697 au BufNewFile,BufRead *.java,*.jav setf java
|
|
698
|
|
699 " JavaCC
|
|
700 au BufNewFile,BufRead *.jj,*.jjt setf javacc
|
|
701
|
|
702 " JavaScript
|
|
703 au BufNewFile,BufRead *.js,*.javascript setf javascript
|
|
704
|
|
705 " Java Server Pages
|
|
706 au BufNewFile,BufRead *.jsp setf jsp
|
|
707
|
|
708 " Java Properties resource file (note: doesn't catch font.properties.pl)
|
216
|
709 au BufNewFile,BufRead *.properties,*.properties_??,*.properties_??_?? setf jproperties
|
|
710 au BufNewFile,BufRead *.properties_??_??_* call s:StarSetf('jproperties')
|
7
|
711
|
|
712 " Jess
|
|
713 au BufNewFile,BufRead *.clp setf jess
|
|
714
|
|
715 " Jgraph
|
|
716 au BufNewFile,BufRead *.jgr setf jgraph
|
|
717
|
|
718 " Kixtart
|
|
719 au BufNewFile,BufRead *.kix setf kix
|
|
720
|
|
721 " Kimwitu[++]
|
|
722 au BufNewFile,BufRead *.k setf kwt
|
|
723
|
|
724 " KDE script
|
|
725 au BufNewFile,BufRead *.ks setf kscript
|
|
726
|
|
727 " Lace (ISE)
|
|
728 au BufNewFile,BufRead *.ace,*.ACE setf lace
|
|
729
|
|
730 " Latte
|
|
731 au BufNewFile,BufRead *.latte,*.lte setf latte
|
|
732
|
|
733 " LambdaProlog (*.mod too, see Modsim)
|
|
734 au BufNewFile,BufRead *.sig setf lprolog
|
|
735
|
|
736 " LDAP LDIF
|
|
737 au BufNewFile,BufRead *.ldif setf ldif
|
|
738
|
|
739 " Lex
|
|
740 au BufNewFile,BufRead *.lex,*.l setf lex
|
|
741
|
|
742 " Libao
|
|
743 au BufNewFile,BufRead /etc/libao.conf,*/.libao setf libao
|
|
744
|
|
745 " LFTP
|
|
746 au BufNewFile,BufRead lftp.conf,.lftprc,*lftp/rc setf lftp
|
|
747
|
|
748 " Lifelines (or Lex for C++!)
|
|
749 au BufNewFile,BufRead *.ll setf lifelines
|
|
750
|
|
751 " Lilo: Linux loader
|
216
|
752 au BufNewFile,BufRead lilo.conf* call s:StarSetf('lilo')
|
7
|
753
|
|
754 " Lisp (*.el = ELisp, *.cl = Common Lisp, *.jl = librep Lisp)
|
|
755 if has("fname_case")
|
|
756 au BufNewFile,BufRead *.lsp,*.lisp,*.el,*.cl,*.jl,*.L,.emacs,.sawfishrc setf lisp
|
|
757 else
|
|
758 au BufNewFile,BufRead *.lsp,*.lisp,*.el,*.cl,*.jl,.emacs,.sawfishrc setf lisp
|
|
759 endif
|
|
760
|
|
761 " Lite
|
|
762 au BufNewFile,BufRead *.lite,*.lt setf lite
|
|
763
|
|
764 " Logtalk
|
|
765 au BufNewFile,BufRead *.lgt setf logtalk
|
|
766
|
|
767 " LOTOS
|
|
768 au BufNewFile,BufRead *.lot,*.lotos setf lotos
|
|
769
|
|
770 " Lout (also: *.lt)
|
|
771 au BufNewFile,BufRead *.lou,*.lout setf lout
|
|
772
|
|
773 " Lua
|
|
774 au BufNewFile,BufRead *.lua setf lua
|
|
775
|
|
776 " Lynx style file (or LotusScript!)
|
|
777 au BufNewFile,BufRead *.lss setf lss
|
|
778
|
|
779 " M4
|
|
780 au BufNewFile,BufRead *.m4
|
|
781 \ if expand("<afile>") !~? 'html.m4$\|fvwm2rc' | setf m4 | endif
|
|
782
|
|
783 " MaGic Point
|
|
784 au BufNewFile,BufRead *.mgp setf mgp
|
|
785
|
|
786 " Mail (for Elm, trn, mutt, rn, slrn)
|
|
787 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
|
|
788
|
|
789 " Mailcap configuration file
|
|
790 au BufNewFile,BufRead .mailcap,mailcap setf mailcap
|
|
791
|
|
792 " Makefile
|
|
793 au BufNewFile,BufRead *[mM]akefile,*.mk,*.mak,*.dsp setf make
|
|
794
|
|
795 " MakeIndex
|
|
796 au BufNewFile,BufRead *.ist,*.mst setf ist
|
|
797
|
|
798 " Manpage
|
|
799 au BufNewFile,BufRead *.man setf man
|
|
800
|
|
801 " Maple V
|
|
802 au BufNewFile,BufRead *.mv,*.mpl,*.mws setf maple
|
|
803
|
|
804 " Mason
|
|
805 au BufNewFile,BufRead *.mason,*.mhtml setf mason
|
|
806
|
|
807 " Matlab or Objective C
|
216
|
808 au BufNewFile,BufRead *.m call s:FTm()
|
7
|
809
|
216
|
810 fun! s:FTm()
|
7
|
811 let n = 1
|
|
812 while n < 10
|
|
813 let line = getline(n)
|
|
814 if line =~ '^\s*\(#\s*\(include\|import\)\>\|/\*\)'
|
|
815 setf objc
|
|
816 return
|
|
817 endif
|
|
818 if line =~ '^\s*%'
|
|
819 setf matlab
|
|
820 return
|
|
821 endif
|
|
822 if line =~ '^\s*(\*'
|
|
823 setf mma
|
|
824 return
|
|
825 endif
|
|
826 let n = n + 1
|
|
827 endwhile
|
271
|
828 if exists("g:filetype_m")
|
|
829 exe "setf " . g:filetype_m
|
|
830 else
|
|
831 setf matlab
|
|
832 endif
|
7
|
833 endfun
|
|
834
|
|
835 " Maya Extension Language
|
|
836 au BufNewFile,BufRead *.mel setf mel
|
|
837
|
|
838 " Metafont
|
|
839 au BufNewFile,BufRead *.mf setf mf
|
|
840
|
|
841 " MetaPost
|
|
842 au BufNewFile,BufRead *.mp setf mp
|
|
843
|
|
844 " MMIX or VMS makefile
|
216
|
845 au BufNewFile,BufRead *.mms call s:FTmms()
|
7
|
846
|
216
|
847 fun! s:FTmms()
|
7
|
848 let n = 1
|
|
849 while n < 10
|
|
850 let line = getline(n)
|
|
851 if line =~ '^\s*\(%\|//\)' || line =~ '^\*'
|
|
852 setf mmix
|
|
853 return
|
|
854 endif
|
|
855 if line =~ '^\s*#'
|
|
856 setf make
|
|
857 return
|
|
858 endif
|
|
859 let n = n + 1
|
|
860 endwhile
|
|
861 setf mmix
|
|
862 endfun
|
|
863
|
|
864
|
|
865 " Modsim III (or LambdaProlog)
|
|
866 au BufNewFile,BufRead *.mod
|
|
867 \ if getline(1) =~ '\<module\>' |
|
|
868 \ setf lprolog |
|
|
869 \ else |
|
|
870 \ setf modsim3 |
|
|
871 \ endif
|
|
872
|
|
873 " Modula 2
|
|
874 au BufNewFile,BufRead *.m2,*.DEF,*.MOD,*.md,*.mi setf modula2
|
|
875
|
|
876 " Modula 3 (.m3, .i3, .mg, .ig)
|
|
877 au BufNewFile,BufRead *.[mi][3g] setf modula3
|
|
878
|
|
879 " Monk
|
|
880 au BufNewFile,BufRead *.isc,*.monk,*.ssc,*.tsc setf monk
|
|
881
|
|
882 " MOO
|
|
883 au BufNewFile,BufRead *.moo setf moo
|
|
884
|
|
885 " Modconf
|
|
886 au BufNewFile,BufRead /etc/modules.conf,/etc/conf.modules setf modconf
|
|
887 au BufNewFile,BufRead /etc/modutils/*
|
216
|
888 \ if executable(expand("<afile>")) != 1
|
|
889 \| call s:StarSetf('modconf')
|
|
890 \|endif
|
7
|
891
|
|
892 " Mplayer config
|
|
893 au BufNewFile,BufRead mplayer.conf,*/.mplayer/config setf mplayerconf
|
|
894
|
|
895 " Moterola S record
|
|
896 au BufNewFile,BufRead *.s19,*.s28,*.s37 setf srec
|
|
897
|
|
898 " Msql
|
|
899 au BufNewFile,BufRead *.msql setf msql
|
|
900
|
|
901 " Mysql
|
|
902 au BufNewFile,BufRead *.mysql setf mysql
|
|
903
|
|
904 " M$ Resource files
|
|
905 au BufNewFile,BufRead *.rc setf rc
|
|
906
|
12
|
907 " MuPAD source
|
|
908 au BufRead,BufNewFile *.mu setf mupad
|
|
909
|
7
|
910 " Mush
|
|
911 au BufNewFile,BufRead *.mush setf mush
|
|
912
|
|
913 " Mutt setup file
|
216
|
914 au BufNewFile,BufRead Muttrc setf muttrc
|
|
915 au BufNewFile,BufRead .muttrc*,*/.mutt/muttrc* call s:StarSetf('muttrc')
|
7
|
916
|
|
917 " Nastran input/DMAP
|
|
918 "au BufNewFile,BufRead *.dat setf nastran
|
|
919
|
|
920 " Natural
|
|
921 au BufNewFile,BufRead *.NS[ACGLMNPS] setf natural
|
|
922
|
39
|
923 " Netrc
|
|
924 au BufNewFile,BufRead .netrc setf netrc
|
|
925
|
7
|
926 " Novell netware batch files
|
|
927 au BufNewFile,BufRead *.ncf setf ncf
|
|
928
|
|
929 " Nroff/Troff (*.ms and *.t are checked below)
|
|
930 au BufNewFile,BufRead *.me
|
|
931 \ if expand("<afile>") != "read.me" && expand("<afile>") != "click.me" |
|
|
932 \ setf nroff |
|
|
933 \ endif
|
|
934 au BufNewFile,BufRead *.tr,*.nr,*.roff,*.tmac,*.mom setf nroff
|
216
|
935 au BufNewFile,BufRead *.[1-9] call s:FTnroff()
|
7
|
936
|
|
937 " This function checks if one of the first five lines start with a dot. In
|
|
938 " that case it is probably an nroff file: 'filetype' is set and 1 is returned.
|
216
|
939 fun! s:FTnroff()
|
7
|
940 if getline(1)[0] . getline(2)[0] . getline(3)[0] . getline(4)[0] . getline(5)[0] =~ '\.'
|
|
941 setf nroff
|
|
942 return 1
|
|
943 endif
|
|
944 return 0
|
|
945 endfun
|
|
946
|
|
947 " Nroff or Objective C++
|
216
|
948 au BufNewFile,BufRead *.mm call s:FTmm()
|
7
|
949
|
216
|
950 fun! s:FTmm()
|
7
|
951 let n = 1
|
|
952 while n < 10
|
|
953 let line = getline(n)
|
|
954 if line =~ '^\s*\(#\s*\(include\|import\)\>\|/\*\)'
|
|
955 setf objcpp
|
|
956 return
|
|
957 endif
|
|
958 let n = n + 1
|
|
959 endwhile
|
|
960 setf nroff
|
|
961 endfun
|
|
962
|
|
963 " Not Quite C
|
|
964 au BufNewFile,BufRead *.nqc setf nqc
|
|
965
|
|
966 " NSIS
|
|
967 au BufNewFile,BufRead *.nsi setf nsis
|
|
968
|
|
969 " OCAML
|
|
970 au BufNewFile,BufRead *.ml,*.mli,*.mll,*.mly setf ocaml
|
|
971
|
|
972 " Occam
|
|
973 au BufNewFile,BufRead *.occ setf occam
|
|
974
|
|
975 " Omnimark
|
|
976 au BufNewFile,BufRead *.xom,*.xin setf omnimark
|
|
977
|
|
978 " OpenROAD
|
|
979 au BufNewFile,BufRead *.or setf openroad
|
|
980
|
|
981 " OPL
|
|
982 au BufNewFile,BufRead *.[Oo][Pp][Ll] setf opl
|
|
983
|
|
984 " Oracle config file
|
|
985 au BufNewFile,BufRead *.ora setf ora
|
|
986
|
|
987 " Packet filter conf
|
|
988 au BufNewFile,BufRead pf.conf setf pf
|
|
989
|
|
990 " PApp
|
|
991 au BufNewFile,BufRead *.papp,*.pxml,*.pxsl setf papp
|
|
992
|
|
993 " Pascal (also *.p)
|
|
994 au BufNewFile,BufRead *.pas setf pascal
|
|
995
|
|
996 " Delphi project file
|
|
997 au BufNewFile,BufRead *.dpr setf pascal
|
|
998
|
|
999 " Perl
|
|
1000 if has("fname_case")
|
216
|
1001 au BufNewFile,BufRead *.pl,*.PL call s:FTpl()
|
7
|
1002 else
|
216
|
1003 au BufNewFile,BufRead *.pl call s:FTpl()
|
7
|
1004 endif
|
11
|
1005 au BufNewFile,BufRead *.plx setf perl
|
7
|
1006
|
216
|
1007 fun! s:FTpl()
|
7
|
1008 if exists("g:filetype_pl")
|
|
1009 exe "setf " . g:filetype_pl
|
|
1010 else
|
|
1011 " recognize Prolog by specific text in the first non-empty line
|
|
1012 " require a blank after the '%' because Perl uses "%list" and "%translate"
|
|
1013 let l = getline(nextnonblank(1))
|
|
1014 if l =~ '\<prolog\>' || l =~ '^\s*\(%\+\(\s\|$\)\|/\*\)' || l =~ ':-'
|
|
1015 setf prolog
|
|
1016 else
|
|
1017 setf perl
|
|
1018 endif
|
|
1019 endif
|
|
1020 endfun
|
|
1021
|
|
1022 " Perl, XPM or XPM2
|
|
1023 au BufNewFile,BufRead *.pm
|
|
1024 \ if getline(1) =~ "XPM2" |
|
|
1025 \ setf xpm2 |
|
|
1026 \ elseif getline(1) =~ "XPM" |
|
|
1027 \ setf xpm |
|
|
1028 \ else |
|
|
1029 \ setf perl |
|
|
1030 \ endif
|
|
1031
|
|
1032 " Perl POD
|
|
1033 au BufNewFile,BufRead *.pod setf pod
|
|
1034
|
|
1035 " Php3
|
|
1036 au BufNewFile,BufRead *.php,*.php3 setf php
|
|
1037
|
|
1038 " Phtml
|
|
1039 au BufNewFile,BufRead *.phtml setf phtml
|
|
1040
|
|
1041 " Pike
|
|
1042 au BufNewFile,BufRead *.pike,*.lpc,*.ulpc,*.pmod setf pike
|
|
1043
|
|
1044 " Pinfo config
|
|
1045 au BufNewFile,BufRead */etc/pinforc,*/.pinforc setf pinfo
|
|
1046
|
|
1047 " Palm Resource compiler
|
|
1048 au BufNewFile,BufRead *.rcp setf pilrc
|
|
1049
|
|
1050 " Pine config
|
|
1051 au BufNewFile,BufRead .pinerc,pinerc,.pinercex,pinercex setf pine
|
|
1052
|
|
1053 " PL/M (also: *.inp)
|
|
1054 au BufNewFile,BufRead *.plm,*.p36,*.pac setf plm
|
|
1055
|
|
1056 " PL/SQL
|
|
1057 au BufNewFile,BufRead *.pls,*.plsql setf plsql
|
|
1058
|
|
1059 " PLP
|
|
1060 au BufNewFile,BufRead *.plp setf plp
|
|
1061
|
|
1062 " PO and PO template (GNU gettext)
|
|
1063 au BufNewFile,BufRead *.po,*.pot setf po
|
|
1064
|
|
1065 " Postfix main config
|
|
1066 au BufNewFile,BufRead main.cf setf pfmain
|
|
1067
|
|
1068 " PostScript (+ font files, encapsulated PostScript, Adobe Illustrator)
|
|
1069 au BufNewFile,BufRead *.ps,*.pfa,*.afm,*.eps,*.epsf,*.epsi,*.ai setf postscr
|
|
1070
|
|
1071 " PostScript Printer Description
|
|
1072 au BufNewFile,BufRead *.ppd setf ppd
|
|
1073
|
|
1074 " Povray
|
|
1075 au BufNewFile,BufRead *.pov setf pov
|
|
1076
|
|
1077 " Povray configuration
|
|
1078 au BufNewFile,BufRead .povrayrc setf povini
|
|
1079
|
|
1080 " Povray, PHP or assembly
|
216
|
1081 au BufNewFile,BufRead *.inc call s:FTinc()
|
7
|
1082
|
216
|
1083 fun! s:FTinc()
|
7
|
1084 if exists("g:filetype_inc")
|
|
1085 exe "setf " . g:filetype_inc
|
|
1086 else
|
|
1087 let lines = getline(1).getline(2).getline(3)
|
|
1088 if lines =~? "perlscript"
|
|
1089 setf aspperl
|
|
1090 elseif lines =~ "<%"
|
|
1091 setf aspvbs
|
|
1092 elseif lines =~ "<?"
|
|
1093 setf php
|
|
1094 else
|
216
|
1095 call s:FTasmsyntax()
|
7
|
1096 if exists("b:asmsyntax")
|
|
1097 exe "setf " . b:asmsyntax
|
|
1098 else
|
|
1099 setf pov
|
|
1100 endif
|
|
1101 endif
|
|
1102 endif
|
|
1103 endfun
|
|
1104
|
|
1105 " Printcap and Termcap
|
|
1106 au BufNewFile,BufRead *printcap
|
|
1107 \ let b:ptcap_type = "print" | setf ptcap
|
|
1108 au BufNewFile,BufRead *termcap
|
|
1109 \ let b:ptcap_type = "term" | setf ptcap
|
|
1110
|
|
1111 " PCCTS / ANTRL
|
|
1112 "au BufNewFile,BufRead *.g setf antrl
|
|
1113 au BufNewFile,BufRead *.g setf pccts
|
|
1114
|
|
1115 " PPWizard
|
|
1116 au BufNewFile,BufRead *.it,*.ih setf ppwiz
|
|
1117
|
|
1118 " Oracle Pro*C/C++
|
|
1119 au BufNewFile,BufRead .pc setf proc
|
|
1120
|
|
1121 " Procmail
|
|
1122 au BufNewFile,BufRead .procmail,.procmailrc setf procmail
|
|
1123
|
|
1124 " Progress or CWEB
|
216
|
1125 au BufNewFile,BufRead *.w call s:FTprogress_cweb()
|
7
|
1126
|
216
|
1127 function! s:FTprogress_cweb()
|
7
|
1128 if exists("g:filetype_w")
|
|
1129 exe "setf " . g:filetype_w
|
|
1130 return
|
|
1131 endif
|
|
1132 if getline(1) =~ '&ANALYZE' || getline(3) =~ '&GLOBAL-DEFINE'
|
|
1133 setf progress
|
|
1134 else
|
|
1135 setf cweb
|
|
1136 endif
|
|
1137 endfun
|
|
1138
|
|
1139 " Progress or assembly
|
216
|
1140 au BufNewFile,BufRead *.i call s:FTprogress_asm()
|
7
|
1141
|
216
|
1142 function! s:FTprogress_asm()
|
7
|
1143 if exists("g:filetype_i")
|
|
1144 exe "setf " . g:filetype_i
|
|
1145 return
|
|
1146 endif
|
|
1147 " This function checks for an assembly comment the first ten lines.
|
|
1148 " If not found, assume Progress.
|
|
1149 let lnum = 1
|
|
1150 while lnum <= 10
|
|
1151 let line = getline(lnum)
|
|
1152 if line =~ '^\s*;' || line =~ '^\*'
|
216
|
1153 call s:FTasm()
|
7
|
1154 return
|
|
1155 elseif line !~ '^\s*$' || line =~ '^/\*'
|
|
1156 " Not an empty line: Doesn't look like valid assembly code.
|
|
1157 " Or it looks like a Progress /* comment
|
|
1158 break
|
|
1159 endif
|
|
1160 let lnum = lnum + 1
|
|
1161 endw
|
|
1162 setf progress
|
|
1163 endfun
|
|
1164
|
|
1165 " Progress or Pascal
|
216
|
1166 au BufNewFile,BufRead *.p call s:FTprogress_pascal()
|
7
|
1167
|
216
|
1168 function! s:FTprogress_pascal()
|
7
|
1169 if exists("g:filetype_p")
|
|
1170 exe "setf " . g:filetype_p
|
|
1171 return
|
|
1172 endif
|
|
1173 " This function checks for valid Pascal syntax in the first ten lines.
|
|
1174 " Look for either an opening comment or a program start.
|
|
1175 " If not found, assume Progress.
|
|
1176 let lnum = 1
|
|
1177 while lnum <= 10
|
|
1178 let line = getline(lnum)
|
|
1179 if line =~ '^\s*\(program\|procedure\|function\|const\|type\|var\)\>'
|
|
1180 \ || line =~ '^\s*{' || line =~ '^\s*(\*'
|
|
1181 setf pascal
|
|
1182 return
|
|
1183 elseif line !~ '^\s*$' || line =~ '^/\*'
|
|
1184 " Not an empty line: Doesn't look like valid Pascal code.
|
|
1185 " Or it looks like a Progress /* comment
|
|
1186 break
|
|
1187 endif
|
|
1188 let lnum = lnum + 1
|
|
1189 endw
|
|
1190 setf progress
|
|
1191 endfun
|
|
1192
|
|
1193
|
|
1194 " Software Distributor Product Specification File (POSIX 1387.2-1995)
|
|
1195 au BufNewFile,BufRead *.psf setf psf
|
|
1196 au BufNewFile,BufRead INDEX,INFO
|
|
1197 \ if getline(1) =~ '^\s*\(distribution\|installed_software\|root\|bundle\|product\)\s*$' |
|
|
1198 \ setf psf |
|
|
1199 \ endif
|
|
1200
|
|
1201 " Prolog
|
|
1202 au BufNewFile,BufRead *.pdb setf prolog
|
|
1203
|
|
1204 " Pyrex
|
|
1205 au BufNewFile,BufRead *.pyx,*.pxd setf pyrex
|
|
1206
|
|
1207 " Python
|
|
1208 au BufNewFile,BufRead *.py,*.pyw setf python
|
|
1209
|
|
1210 " Radiance
|
|
1211 au BufNewFile,BufRead *.rad,*.mat setf radiance
|
|
1212
|
|
1213 " Ratpoison config/command files
|
|
1214 au BufNewFile,BufRead .ratpoisonrc,ratpoisonrc setf ratpoison
|
|
1215
|
|
1216 " RCS file
|
|
1217 au BufNewFile,BufRead *\,v setf rcs
|
|
1218
|
|
1219 " Readline
|
237
|
1220 au BufNewFile,BufRead .inputrc,inputrc setf readline
|
7
|
1221
|
|
1222 " Registry for MS-Windows
|
|
1223 au BufNewFile,BufRead *.reg
|
|
1224 \ if getline(1) =~? '^REGEDIT[0-9]*\s*$\|^Windows Registry Editor Version \d*\.\d*\s*$' | setf registry | endif
|
|
1225
|
|
1226 " Renderman Interface Bytestream
|
|
1227 au BufNewFile,BufRead *.rib setf rib
|
|
1228
|
|
1229 " Rexx
|
|
1230 au BufNewFile,BufRead *.rexx,*.rex setf rexx
|
|
1231
|
|
1232 " R (Splus)
|
|
1233 au BufNewFile,BufRead *.s,*.S setf r
|
|
1234
|
|
1235 " Rexx, Rebol or R
|
216
|
1236 au BufNewFile,BufRead *.r,*.R call s:FTr()
|
7
|
1237
|
216
|
1238 fun! s:FTr()
|
7
|
1239 if getline(1) =~ '^REBOL'
|
|
1240 setf rebol
|
|
1241 else
|
|
1242 let n = 1
|
|
1243 let max = line("$")
|
|
1244 if max > 50
|
|
1245 let max = 50
|
|
1246 endif
|
|
1247 while n < max
|
|
1248 " R has # comments
|
|
1249 if getline(n) =~ '^\s*#'
|
|
1250 setf r
|
|
1251 break
|
|
1252 endif
|
|
1253 " Rexx has /* comments */
|
|
1254 if getline(n) =~ '^\s*/\*'
|
|
1255 setf rexx
|
|
1256 break
|
|
1257 endif
|
|
1258 let n = n + 1
|
|
1259 endwhile
|
|
1260 if n >= max
|
|
1261 setf rexx
|
|
1262 endif
|
|
1263 endif
|
|
1264 endfun
|
|
1265
|
|
1266 " Remind
|
216
|
1267 au BufNewFile,BufRead .reminders* call s:StarSetf('remind')
|
7
|
1268
|
|
1269 " Resolv.conf
|
|
1270 au BufNewFile,BufRead resolv.conf setf resolv
|
|
1271
|
|
1272 " Relax NG Compact
|
|
1273 au BufNewFile,BufRead *.rnc setf rnc
|
|
1274
|
|
1275 " RPL/2
|
|
1276 au BufNewFile,BufRead *.rpl setf rpl
|
|
1277
|
|
1278 " Robots.txt
|
|
1279 au BufNewFile,BufRead robots.txt setf robots
|
|
1280
|
|
1281 " Rpcgen
|
|
1282 au BufNewFile,BufRead *.x setf rpcgen
|
|
1283
|
|
1284 " reStructuredText Documentation Format
|
|
1285 au BufNewFile,BufRead *.rst setf rst
|
|
1286
|
|
1287 " RTF
|
|
1288 au BufNewFile,BufRead *.rtf setf rtf
|
|
1289
|
|
1290 " Ruby
|
|
1291 au BufNewFile,BufRead *.rb,*.rbw,*.gem,*.gemspec setf ruby
|
|
1292
|
|
1293 " S-lang (or shader language!)
|
|
1294 au BufNewFile,BufRead *.sl setf slang
|
|
1295
|
|
1296 " Samba config
|
|
1297 au BufNewFile,BufRead smb.conf setf samba
|
|
1298
|
|
1299 " SAS script
|
|
1300 au BufNewFile,BufRead *.sas setf sas
|
|
1301
|
|
1302 " Sather
|
|
1303 au BufNewFile,BufRead *.sa setf sather
|
|
1304
|
|
1305 " Scilab
|
|
1306 au BufNewFile,BufRead *.sci setf scilab
|
|
1307
|
|
1308 " SDL
|
|
1309 au BufNewFile,BufRead *.sdl,*.pr setf sdl
|
|
1310
|
|
1311 " sed
|
|
1312 au BufNewFile,BufRead *.sed setf sed
|
|
1313
|
36
|
1314 " Sieve (RFC 3028)
|
|
1315 au BufNewFile,BufRead *.siv setf sieve
|
|
1316
|
7
|
1317 " Sendmail
|
|
1318 au BufNewFile,BufRead sendmail.cf setf sm
|
|
1319
|
|
1320 " Sendmail .mc files are actually m4
|
|
1321 au BufNewFile,BufRead *.mc setf m4
|
|
1322
|
|
1323 " SGML
|
|
1324 au BufNewFile,BufRead *.sgm,*.sgml
|
|
1325 \ if getline(1).getline(2).getline(3).getline(4).getline(5) =~? 'linuxdoc' |
|
|
1326 \ setf sgmllnx |
|
|
1327 \ elseif getline(1) =~ '<!DOCTYPE.*DocBook' || getline(2) =~ '<!DOCTYPE.*DocBook' |
|
|
1328 \ let b:docbk_type="sgml" |
|
|
1329 \ setf docbk |
|
|
1330 \ else |
|
|
1331 \ setf sgml |
|
|
1332 \ endif
|
|
1333
|
|
1334 " SGMLDECL
|
|
1335 au BufNewFile,BufRead *.decl,*.dcl,*.dec
|
|
1336 \ if getline(1).getline(2).getline(3) =~? '^<!SGML' |
|
|
1337 \ setf sgmldecl |
|
|
1338 \ endif
|
|
1339
|
|
1340 " SGML catalog file
|
216
|
1341 au BufNewFile,BufRead catalog setf catalog
|
|
1342 au BufNewFile,BufRead sgml.catalog* call s:StarSetf('catalog')
|
7
|
1343
|
|
1344 " Shell scripts (sh, ksh, bash, bash2, csh); Allow .profile_foo etc.
|
|
1345 " Gentoo ebuilds are actually bash scripts
|
|
1346 au BufNewFile,BufRead .bashrc*,bashrc,bash.bashrc,.bash_profile*,.bash_logout*,*.bash,*.ebuild call SetFileTypeSH("bash")
|
|
1347 au BufNewFile,BufRead .kshrc*,*.ksh call SetFileTypeSH("ksh")
|
|
1348 au BufNewFile,BufRead /etc/profile,.profile*,*.sh,*.env call SetFileTypeSH(getline(1))
|
|
1349
|
216
|
1350 " Also called from scripts.vim.
|
7
|
1351 fun! SetFileTypeSH(name)
|
216
|
1352 if expand("<amatch>") =~ g:ft_ignore_pat
|
|
1353 return
|
|
1354 endif
|
7
|
1355 if a:name =~ '\<ksh\>'
|
|
1356 let b:is_kornshell = 1
|
|
1357 if exists("b:is_bash")
|
|
1358 unlet b:is_bash
|
|
1359 endif
|
|
1360 if exists("b:is_sh")
|
|
1361 unlet b:is_sh
|
|
1362 endif
|
|
1363 elseif exists("g:bash_is_sh") || a:name =~ '\<bash\>' || a:name =~ '\<bash2\>'
|
|
1364 let b:is_bash = 1
|
|
1365 if exists("b:is_kornshell")
|
|
1366 unlet b:is_kornshell
|
|
1367 endif
|
|
1368 if exists("b:is_sh")
|
|
1369 unlet b:is_sh
|
|
1370 endif
|
|
1371 elseif a:name =~ '\<sh\>'
|
|
1372 let b:is_sh = 1
|
|
1373 if exists("b:is_kornshell")
|
|
1374 unlet b:is_kornshell
|
|
1375 endif
|
|
1376 if exists("b:is_bash")
|
|
1377 unlet b:is_bash
|
|
1378 endif
|
|
1379 endif
|
26
|
1380 call SetFileTypeShell("sh")
|
|
1381 endfun
|
|
1382
|
|
1383 " For shell-like file types, check for an "exec" command hidden in a comment,
|
|
1384 " as used for Tcl.
|
216
|
1385 " Also called from scripts.vim, thus can't be local to this script.
|
26
|
1386 fun! SetFileTypeShell(name)
|
216
|
1387 if expand("<amatch>") =~ g:ft_ignore_pat
|
|
1388 return
|
|
1389 endif
|
26
|
1390 let l = 2
|
|
1391 while l < 20 && l < line("$") && getline(l) =~ '^\s*\(#\|$\)'
|
|
1392 " Skip empty and comment lines.
|
|
1393 let l = l + 1
|
|
1394 endwhile
|
|
1395 if l < line("$") && getline(l) =~ '\s*exec\s' && getline(l - 1) =~ '^\s*#.*\\$'
|
|
1396 " Found an "exec" line after a comment with continuation
|
|
1397 let n = substitute(getline(l),'\s*exec\s\+\([^ ]*/\)\=', '', '')
|
|
1398 if n =~ '\<tclsh\|\<wish'
|
|
1399 setf tcl
|
|
1400 return
|
|
1401 endif
|
|
1402 endif
|
|
1403 exe "setf " . a:name
|
7
|
1404 endfun
|
|
1405
|
|
1406 " tcsh scripts
|
26
|
1407 au BufNewFile,BufRead .tcshrc*,*.tcsh,tcsh.tcshrc,tcsh.login call SetFileTypeShell("tcsh")
|
7
|
1408
|
|
1409 " csh scripts, but might also be tcsh scripts (on some systems csh is tcsh)
|
216
|
1410 au BufNewFile,BufRead .login*,.cshrc*,csh.cshrc,csh.login,csh.logout,*.csh,.alias call s:CSH()
|
7
|
1411
|
216
|
1412 fun! s:CSH()
|
7
|
1413 if exists("g:filetype_csh")
|
26
|
1414 call SetFileTypeShell(g:filetype_csh)
|
7
|
1415 elseif &shell =~ "tcsh"
|
26
|
1416 call SetFileTypeShell("tcsh")
|
7
|
1417 else
|
26
|
1418 call SetFileTypeShell("csh")
|
7
|
1419 endif
|
|
1420 endfun
|
|
1421
|
|
1422 " Z-Shell script
|
216
|
1423 au BufNewFile,BufRead .zprofile,/etc/zprofile,.zfbfmarks setf zsh
|
|
1424 au BufNewFile,BufRead .zsh*,.zlog*,.zcompdump* call s:StarSetf('zsh')
|
7
|
1425
|
|
1426 " Scheme
|
|
1427 au BufNewFile,BufRead *.scm,*.ss setf scheme
|
|
1428
|
|
1429 " Screen RC
|
|
1430 au BufNewFile,BufRead .screenrc,screenrc setf screen
|
|
1431
|
|
1432 " Simula
|
|
1433 au BufNewFile,BufRead *.sim setf simula
|
|
1434
|
|
1435 " SINDA
|
|
1436 au BufNewFile,BufRead *.sin,*.s85 setf sinda
|
|
1437
|
|
1438 " SKILL
|
|
1439 au BufNewFile,BufRead *.il setf skill
|
|
1440
|
|
1441 " SLRN
|
|
1442 au BufNewFile,BufRead .slrnrc setf slrnrc
|
|
1443 au BufNewFile,BufRead *.score setf slrnsc
|
|
1444
|
271
|
1445 " Smalltalk (and TeX)
|
|
1446 au BufNewFile,BufRead *.st setf st
|
|
1447 au BufNewFile,BufRead *.cls
|
|
1448 \ if getline(1) =~ '^%' |
|
|
1449 \ setf tex |
|
|
1450 \ else |
|
|
1451 \ setf st |
|
|
1452 \ endif
|
7
|
1453
|
|
1454 " Smarty templates
|
|
1455 au BufNewFile,BufRead *.tpl setf smarty
|
|
1456
|
|
1457 " SMIL or XML
|
|
1458 au BufNewFile,BufRead *.smil
|
|
1459 \ if getline(1) =~ '<?\s*xml.*?>' |
|
|
1460 \ setf xml |
|
|
1461 \ else |
|
|
1462 \ setf smil |
|
|
1463 \ endif
|
|
1464
|
|
1465 " SMIL or SNMP MIB file
|
|
1466 au BufNewFile,BufRead *.smi
|
|
1467 \ if getline(1) =~ '\<smil\>' |
|
|
1468 \ setf smil |
|
|
1469 \ else |
|
|
1470 \ setf mib |
|
|
1471 \ endif
|
|
1472
|
|
1473 " SMITH
|
|
1474 au BufNewFile,BufRead *.smt,*.smith setf smith
|
|
1475
|
|
1476 " Snobol4
|
|
1477 au BufNewFile,BufRead *.sno setf snobol4
|
|
1478
|
|
1479 " SNMP MIB files
|
|
1480 au BufNewFile,BufRead *.mib,*.my setf mib
|
|
1481
|
|
1482 " Snort Configuration
|
|
1483 au BufNewFile,BufRead *.hog,snort.conf,vision.conf,*.rules setf hog
|
|
1484
|
|
1485 " Spec (Linux RPM)
|
|
1486 au BufNewFile,BufRead *.spec setf spec
|
|
1487
|
|
1488 " Speedup (AspenTech plant simulator)
|
|
1489 au BufNewFile,BufRead *.speedup,*.spdata,*.spd setf spup
|
|
1490
|
|
1491 " Slice
|
|
1492 au BufNewFile,BufRead *.ice setf slice
|
|
1493
|
|
1494 " Spice
|
|
1495 au BufNewFile,BufRead *.sp,*.spice setf spice
|
|
1496
|
|
1497 " Spyce
|
|
1498 au BufNewFile,BufRead *.spy,*.spi setf spyce
|
|
1499
|
|
1500 " Squid
|
|
1501 au BufNewFile,BufRead squid.conf setf squid
|
|
1502
|
22
|
1503 " SQL for Oracle Designer
|
|
1504 au BufNewFile,BufRead *.tyb,*.typ,*.tyc,*.pkb,*.pks setf sql
|
|
1505
|
|
1506 " SQL
|
216
|
1507 au BufNewFile,BufRead *.sql call s:SQL()
|
22
|
1508
|
216
|
1509 fun! s:SQL()
|
22
|
1510 if exists("g:filetype_sql")
|
|
1511 exe "setf " . g:filetype_sql
|
|
1512 else
|
|
1513 setf sql
|
|
1514 endif
|
|
1515 endfun
|
7
|
1516
|
|
1517 " SQLJ
|
|
1518 au BufNewFile,BufRead *.sqlj setf sqlj
|
|
1519
|
|
1520 " SQR
|
|
1521 au BufNewFile,BufRead *.sqr,*.sqi setf sqr
|
|
1522
|
|
1523 " OpenSSH configuration
|
|
1524 au BufNewFile,BufRead ssh_config,*/.ssh/config setf sshconfig
|
|
1525
|
|
1526 " OpenSSH server configuration
|
|
1527 au BufNewFile,BufRead sshd_config setf sshdconfig
|
|
1528
|
|
1529 " Stored Procedures
|
|
1530 au BufNewFile,BufRead *.stp setf stp
|
|
1531
|
|
1532 " Standard ML
|
|
1533 au BufNewFile,BufRead *.sml setf sml
|
|
1534
|
39
|
1535 " Sudoers
|
|
1536 au BufNewFile,BufRead /etc/sudoers,sudoers.tmp setf sudoers
|
|
1537
|
7
|
1538 " Tads (or Nroff)
|
|
1539 au BufNewFile,BufRead *.t
|
216
|
1540 \ if !s:FTnroff() | setf tads | endif
|
7
|
1541
|
|
1542 " Tags
|
|
1543 au BufNewFile,BufRead tags setf tags
|
|
1544
|
|
1545 " TAK
|
|
1546 au BufNewFile,BufRead *.tak setf tak
|
|
1547
|
|
1548 " Tcl
|
|
1549 au BufNewFile,BufRead *.tcl,*.tk,*.itcl,*.itk setf tcl
|
|
1550
|
|
1551 " TealInfo
|
|
1552 au BufNewFile,BufRead *.tli setf tli
|
|
1553
|
|
1554 " Telix Salt
|
|
1555 au BufNewFile,BufRead *.slt setf tsalt
|
|
1556
|
|
1557 " Terminfo
|
|
1558 au BufNewFile,BufRead *.ti setf terminfo
|
|
1559
|
|
1560 " TeX
|
|
1561 au BufNewFile,BufRead *.tex,*.latex,*.sty,*.dtx,*.ltx,*.bbl setf tex
|
|
1562
|
|
1563 " Texinfo
|
|
1564 au BufNewFile,BufRead *.texinfo,*.texi,*.txi setf texinfo
|
|
1565
|
|
1566 " TeX configuration
|
|
1567 au BufNewFile,BufRead texmf.cnf setf texmf
|
|
1568
|
|
1569 " Tidy config
|
|
1570 au BufNewFile,BufRead .tidyrc,tidyrc setf tidy
|
|
1571
|
|
1572 " TF mud client
|
|
1573 au BufNewFile,BufRead *.tf,.tfrc,tfrc setf tf
|
|
1574
|
33
|
1575 " TPP - Text Presentation Program
|
|
1576 au BufNewFile,BufReadPost *.tpp setf tpp
|
|
1577
|
7
|
1578 " TSS - Geometry
|
|
1579 au BufNewFile,BufReadPost *.tssgm setf tssgm
|
|
1580
|
|
1581 " TSS - Optics
|
|
1582 au BufNewFile,BufReadPost *.tssop setf tssop
|
|
1583
|
|
1584 " TSS - Command Line (temporary)
|
|
1585 au BufNewFile,BufReadPost *.tsscl setf tsscl
|
|
1586
|
|
1587 " Motif UIT/UIL files
|
|
1588 au BufNewFile,BufRead *.uit,*.uil setf uil
|
|
1589
|
|
1590 " UnrealScript
|
|
1591 au BufNewFile,BufRead *.uc setf uc
|
|
1592
|
|
1593 " Verilog HDL
|
|
1594 au BufNewFile,BufRead *.v setf verilog
|
|
1595
|
|
1596 " VHDL
|
216
|
1597 au BufNewFile,BufRead *.hdl,*.vhd,*.vhdl,*.vbe,*.vst setf vhdl
|
|
1598 au BufNewFile,BufRead *.vhdl_[0-9]* call s:StarSetf('vhdl')
|
7
|
1599
|
|
1600 " Vim script
|
|
1601 au BufNewFile,BufRead *.vim,.exrc,_exrc setf vim
|
|
1602
|
|
1603 " Viminfo file
|
|
1604 au BufNewFile,BufRead .viminfo,_viminfo setf viminfo
|
|
1605
|
|
1606 " Virata Config Script File
|
|
1607 au BufRead,BufNewFile *.hw,*.module,*.pkg setf virata
|
|
1608
|
|
1609 " Visual Basic (also uses *.bas) or FORM
|
216
|
1610 au BufNewFile,BufRead *.frm call s:FTVB("form")
|
7
|
1611
|
|
1612 " SaxBasic is close to Visual Basic
|
|
1613 au BufNewFile,BufRead *.sba setf vb
|
|
1614
|
|
1615 " Vgrindefs file
|
|
1616 au BufNewFile,BufRead vgrindefs setf vgrindefs
|
|
1617
|
|
1618 " VRML V1.0c
|
|
1619 au BufNewFile,BufRead *.wrl setf vrml
|
|
1620
|
|
1621 " Webmacro
|
|
1622 au BufNewFile,BufRead *.wm setf webmacro
|
|
1623
|
|
1624 " Wget config
|
|
1625 au BufNewFile,BufRead .wgetrc,wgetrc setf wget
|
|
1626
|
|
1627 " Website MetaLanguage
|
|
1628 au BufNewFile,BufRead *.wml setf wml
|
|
1629
|
|
1630 " Winbatch
|
|
1631 au BufNewFile,BufRead *.wbt setf winbatch
|
|
1632
|
|
1633 " WvDial
|
|
1634 au BufNewFile,BufRead wvdial.conf,.wvdialrc setf wvdial
|
|
1635
|
|
1636 " CVS RC file
|
|
1637 au BufNewFile,BufRead .cvsrc setf cvsrc
|
|
1638
|
|
1639 " CVS commit file
|
|
1640 au BufNewFile,BufRead cvs\d\+ setf cvs
|
|
1641
|
|
1642 " WEB (*.web is also used for Winbatch: Guess, based on expecting "%" comment
|
|
1643 " lines in a WEB file).
|
|
1644 au BufNewFile,BufRead *.web
|
|
1645 \ if getline(1)[0].getline(2)[0].getline(3)[0].getline(4)[0].getline(5)[0] =~ "%" |
|
|
1646 \ setf web |
|
|
1647 \ else |
|
|
1648 \ setf winbatch |
|
|
1649 \ endif
|
|
1650
|
|
1651 " Windows Scripting Host and Windows Script Component
|
|
1652 au BufNewFile,BufRead *.ws[fc] setf wsh
|
|
1653
|
|
1654 " X Pixmap (dynamically sets colors, use BufEnter to make it work better)
|
|
1655 au BufEnter *.xpm
|
|
1656 \ if getline(1) =~ "XPM2" |
|
|
1657 \ setf xpm2 |
|
|
1658 \ else |
|
|
1659 \ setf xpm |
|
|
1660 \ endif
|
|
1661 au BufEnter *.xpm2 setf xpm2
|
|
1662
|
|
1663 " XFree86 config
|
|
1664 au BufNewFile,BufRead XF86Config
|
|
1665 \ if getline(1) =~ '\<XConfigurator\>' |
|
|
1666 \ let b:xf86c_xfree86_version = 3 |
|
|
1667 \ endif |
|
|
1668 \ setf xf86conf
|
|
1669
|
|
1670 " Xorg config
|
|
1671 au BufNewFile,BufRead xorg.conf,xorg.conf-4 let b:xf86c_xfree86_version = 4 | setf xf86conf
|
|
1672
|
|
1673 " XS Perl extension interface language
|
|
1674 au BufNewFile,BufRead *.xs setf xs
|
|
1675
|
|
1676 " X resources file
|
|
1677 au BufNewFile,BufRead .Xdefaults,.Xpdefaults,.Xresources,xdm-config,*.ad setf xdefaults
|
|
1678
|
|
1679 " Xmath
|
|
1680 au BufNewFile,BufRead *.msc,*.msf setf xmath
|
|
1681 au BufNewFile,BufRead *.ms
|
216
|
1682 \ if !s:FTnroff() | setf xmath | endif
|
7
|
1683
|
|
1684 " XML
|
|
1685 au BufNewFile,BufRead *.xml
|
|
1686 \ if getline(1) . getline(2) . getline(3) =~ '<!DOCTYPE.*DocBook' |
|
|
1687 \ let b:docbk_type="xml" |
|
|
1688 \ setf docbk |
|
|
1689 \ else |
|
|
1690 \ setf xml |
|
|
1691 \ endif
|
|
1692
|
|
1693 " XMI (holding UML models) is also XML
|
|
1694 au BufNewFile,BufRead *.xmi setf xml
|
|
1695
|
|
1696 " CSPROJ files are Visual Studio.NET's XML-based project config files
|
|
1697 au BufNewFile,BufRead *.csproj,*.csproj.user setf xml
|
|
1698
|
|
1699 " Qt Linguist translation source and Qt User Interface Files are XML
|
|
1700 au BufNewFile,BufRead *.ts,*.ui setf xml
|
|
1701
|
|
1702 " XSD
|
|
1703 au BufNewFile,BufRead *.xsd setf xsd
|
|
1704
|
|
1705 " Xslt
|
|
1706 au BufNewFile,BufRead *.xsl,*.xslt setf xslt
|
|
1707
|
|
1708 " Yacc
|
|
1709 au BufNewFile,BufRead *.y,*.yy setf yacc
|
|
1710
|
|
1711 " Yaml
|
|
1712 au BufNewFile,BufRead *.yaml,*.yml setf yaml
|
|
1713
|
|
1714 " Z80 assembler asz80
|
|
1715 au BufNewFile,BufRead *.z8a setf z8a
|
|
1716
|
|
1717 augroup END
|
|
1718
|
|
1719
|
|
1720 " Source the user-specified filetype file, for backwards compatibility with
|
|
1721 " Vim 5.x.
|
216
|
1722 if exists("myfiletypefile") && filereadable(expand(myfiletypefile))
|
7
|
1723 execute "source " . myfiletypefile
|
|
1724 endif
|
|
1725
|
|
1726
|
|
1727 " Check for "*" after loading myfiletypefile, so that scripts.vim is only used
|
|
1728 " when there are no matching file name extensions.
|
|
1729 " Don't do this for compressed files.
|
|
1730 augroup filetypedetect
|
|
1731 au BufNewFile,BufRead *
|
|
1732 \ if !did_filetype() && expand("<amatch>") !~ g:ft_ignore_pat
|
|
1733 \ | runtime! scripts.vim | endif
|
|
1734 au StdinReadPost * if !did_filetype() | runtime! scripts.vim | endif
|
|
1735
|
|
1736
|
|
1737 " Extra checks for when no filetype has been detected now. Mostly used for
|
|
1738 " patterns that end in "*". E.g., "zsh*" matches "zsh.vim", but that's a Vim
|
|
1739 " script file.
|
216
|
1740 " Most of these should call s:StarSetf() to avoid names ending in .gz and the
|
|
1741 " like are used.
|
7
|
1742
|
|
1743 " BIND zone
|
216
|
1744 au BufNewFile,BufRead /var/named/* call s:StarSetf('bindzone')
|
7
|
1745
|
|
1746 " Changelog
|
216
|
1747 au BufNewFile,BufRead [cC]hange[lL]og*
|
|
1748 \ if getline(1) =~ '; urgency='
|
|
1749 \| call s:StarSetf('debchangelog')
|
|
1750 \|else
|
|
1751 \| call s:StarSetf('changelog')
|
|
1752 \|endif
|
7
|
1753
|
|
1754 " Crontab
|
216
|
1755 au BufNewFile,BufRead crontab,crontab.* call s:StarSetf('crontab')
|
7
|
1756
|
|
1757 " Dracula
|
216
|
1758 au BufNewFile,BufRead drac.* call s:StarSetf('dracula')
|
7
|
1759
|
|
1760 " Fvwm
|
|
1761 au BufNewFile,BufRead *fvwmrc*,*fvwm95*.hook
|
216
|
1762 \ let b:fvwm_version = 1 | call s:StarSetf('fvwm')
|
7
|
1763 au BufNewFile,BufRead *fvwm2rc*
|
216
|
1764 \ if expand("<afile>:e") == "m4"
|
|
1765 \| call s:StarSetf('fvwm2m4')
|
|
1766 \|else
|
|
1767 \| let b:fvwm_version = 2 | call s:StarSetf('fvwm')
|
|
1768 \|endif
|
7
|
1769
|
|
1770 " GTK RC
|
216
|
1771 au BufNewFile,BufRead .gtkrc*,gtkrc* call s:StarSetf('gtkrc')
|
7
|
1772
|
|
1773 " Jam
|
216
|
1774 au BufNewFile,BufRead Prl*.*,JAM*.* call s:StarSetf('jam')
|
7
|
1775
|
|
1776 " Jargon
|
|
1777 au! BufNewFile,BufRead *jarg*
|
216
|
1778 \ if getline(1).getline(2).getline(3).getline(4).getline(5) =~? 'THIS IS THE JARGON FILE'
|
|
1779 \| call s:StarSetf('jargon')
|
|
1780 \|endif
|
7
|
1781
|
|
1782 " Makefile
|
216
|
1783 au BufNewFile,BufRead [mM]akefile* call s:StarSetf('make')
|
7
|
1784
|
|
1785 " Ruby Makefile
|
216
|
1786 au BufNewFile,BufRead [rR]akefile* call s:StarSetf('ruby')
|
7
|
1787
|
|
1788 " Mutt setup file
|
216
|
1789 au BufNewFile,BufRead muttrc*,Muttrc* call s:StarSetf('muttrc')
|
7
|
1790
|
|
1791 " Nroff macros
|
216
|
1792 au BufNewFile,BufRead tmac.* call s:StarSetf('nroff')
|
7
|
1793
|
|
1794 " Printcap and Termcap
|
|
1795 au BufNewFile,BufRead *printcap*
|
216
|
1796 \ if !did_filetype()
|
|
1797 \| let b:ptcap_type = "print" | call s:StarSetf('ptcap')
|
|
1798 \|endif
|
7
|
1799 au BufNewFile,BufRead *termcap*
|
216
|
1800 \ if !did_filetype()
|
|
1801 \| let b:ptcap_type = "term" | call s:StarSetf('ptcap')
|
|
1802 \|endif
|
7
|
1803
|
|
1804 " Vim script
|
216
|
1805 au BufNewFile,BufRead *vimrc* call s:StarSetf('vim')
|
7
|
1806
|
|
1807 " Subversion commit file
|
45
|
1808 au BufNewFile,BufRead svn-commit*.tmp setf svn
|
7
|
1809
|
|
1810 " X resources file
|
216
|
1811 au BufNewFile,BufRead Xresources*,*/app-defaults/*,*/Xresources/* call s:StarSetf('xdefaults')
|
7
|
1812
|
|
1813 " XFree86 config
|
|
1814 au BufNewFile,BufRead XF86Config-4*
|
216
|
1815 \ let b:xf86c_xfree86_version = 4 | call s:StarSetf('xf86conf')
|
7
|
1816 au BufNewFile,BufRead XF86Config*
|
216
|
1817 \ if getline(1) =~ '\<XConfigurator\>'
|
|
1818 \| let b:xf86c_xfree86_version = 3
|
|
1819 \|endif
|
|
1820 \|call s:StarSetf('xf86conf')
|
7
|
1821
|
|
1822 " X11 xmodmap
|
216
|
1823 au BufNewFile,BufRead *xmodmap* call s:StarSetf('xmodmap')
|
7
|
1824
|
|
1825 " Z-Shell script
|
216
|
1826 au BufNewFile,BufRead zsh*,zlog* call s:StarSetf('zsh')
|
7
|
1827
|
|
1828
|
|
1829 " Generic configuration file (check this last, it's just guessing!)
|
|
1830 au BufNewFile,BufRead,StdinReadPost *
|
|
1831 \ if !did_filetype() && expand("<amatch>") !~ g:ft_ignore_pat
|
|
1832 \ && (getline(1) =~ '^#' || getline(2) =~ '^#' || getline(3) =~ '^#'
|
|
1833 \ || getline(4) =~ '^#' || getline(5) =~ '^#') |
|
|
1834 \ setf conf |
|
|
1835 \ endif
|
|
1836
|
|
1837 " Use the plugin-filetype checks last, they may overrule any of the previously
|
|
1838 " detected filetypes.
|
|
1839 runtime! ftdetect/*.vim
|
|
1840
|
|
1841 augroup END
|
|
1842
|
|
1843
|
|
1844 " If the GUI is already running, may still need to install the Syntax menu.
|
|
1845 " Don't do it when the 'M' flag is included in 'guioptions'.
|
|
1846 if has("menu") && has("gui_running")
|
|
1847 \ && !exists("did_install_syntax_menu") && &guioptions !~# "M"
|
|
1848 source <sfile>:p:h/menu.vim
|
|
1849 endif
|
|
1850
|
|
1851 " Restore 'cpoptions'
|
|
1852 let &cpo = s:cpo_save
|
|
1853 unlet s:cpo_save
|