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