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