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