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