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