-
Notifications
You must be signed in to change notification settings - Fork 0
/
filetype.vim
2517 lines (1949 loc) · 63.7 KB
/
filetype.vim
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
" Vim support file to detect file types
"
" Maintainer: Bram Moolenaar <[email protected]>
" Last Change: 2010 Sep 29
" Listen very carefully, I will say this only once
if exists("did_load_filetypes")
finish
endif
let did_load_filetypes = 1
" Line continuation is used here, remove 'C' from 'cpoptions'
let s:cpo_save = &cpo
set cpo&vim
augroup filetypedetect
" Ignored extensions
if exists("*fnameescape")
au BufNewFile,BufRead ?\+.orig,?\+.bak,?\+.old,?\+.new,?\+.dpkg-dist,?\+.dpkg-old,?\+.rpmsave,?\+.rpmnew
\ exe "doau filetypedetect BufRead " . fnameescape(expand("<afile>:r"))
au BufNewFile,BufRead *~
\ let s:name = expand("<afile>") |
\ let s:short = substitute(s:name, '\~$', '', '') |
\ if s:name != s:short && s:short != "" |
\ exe "doau filetypedetect BufRead " . fnameescape(s:short) |
\ endif |
\ unlet! s:name s:short
au BufNewFile,BufRead ?\+.in
\ if expand("<afile>:t") != "configure.in" |
\ exe "doau filetypedetect BufRead " . fnameescape(expand("<afile>:r")) |
\ endif
elseif &verbose > 0
echomsg "Warning: some filetypes will not be recognized because this version of Vim does not have fnameescape()"
endif
" Pattern used to match file names which should not be inspected.
" Currently finds compressed files.
if !exists("g:ft_ignore_pat")
let g:ft_ignore_pat = '\.\(Z\|gz\|bz2\|zip\|tgz\)$'
endif
" Function used for patterns that end in a star: don't set the filetype if the
" file name matches ft_ignore_pat.
func! s:StarSetf(ft)
if expand("<amatch>") !~ g:ft_ignore_pat
exe 'setf ' . a:ft
endif
endfunc
" Abaqus or Trasys
au BufNewFile,BufRead *.inp call s:Check_inp()
func! s:Check_inp()
if getline(1) =~ '^\*'
setf abaqus
else
let n = 1
if line("$") > 500
let nmax = 500
else
let nmax = line("$")
endif
while n <= nmax
if getline(n) =~? "^header surface data"
setf trasys
break
endif
let n = n + 1
endwhile
endif
endfunc
" A-A-P recipe
au BufNewFile,BufRead *.aap setf aap
" A2ps printing utility
au BufNewFile,BufRead etc/a2ps.cfg,etc/a2ps/*.cfg,a2psrc,.a2psrc setf a2ps
" ABAB/4
au BufNewFile,BufRead *.abap setf abap
" ABC music notation
au BufNewFile,BufRead *.abc setf abc
" ABEL
au BufNewFile,BufRead *.abl setf abel
" AceDB
au BufNewFile,BufRead *.wrm setf acedb
" Ada (83, 9X, 95)
au BufNewFile,BufRead *.adb,*.ads,*.ada setf ada
if has("vms")
au BufNewFile,BufRead *.gpr,*.ada_m,*.adc setf ada
else
au BufNewFile,BufRead *.gpr setf ada
endif
" AHDL
au BufNewFile,BufRead *.tdf setf ahdl
" AMPL
au BufNewFile,BufRead *.run setf ampl
" Ant
au BufNewFile,BufRead build.xml setf ant
" Apache style config file
au BufNewFile,BufRead proftpd.conf* call s:StarSetf('apachestyle')
" Apache config file
au BufNewFile,BufRead .htaccess,/etc/httpd/*.conf setf apache
au BufNewFile,BufRead httpd.conf*,srm.conf*,access.conf*,apache.conf*,apache2.conf*,/etc/apache2/*.conf*,/etc/httpd/conf.d/*.conf* call s:StarSetf('apache')
" XA65 MOS6510 cross assembler
au BufNewFile,BufRead *.a65 setf a65
" Applescript
au BufNewFile,BufRead *.scpt setf applescript
" Applix ELF
au BufNewFile,BufRead *.am
\ if expand("<afile>") !~? 'Makefile.am\>' | setf elf | endif
" ALSA configuration
au BufNewFile,BufRead ~/.asoundrc,/usr/share/alsa/alsa.conf,/etc/asound.conf setf alsaconf
" Arc Macro Language
au BufNewFile,BufRead *.aml setf aml
" Arch Inventory file
au BufNewFile,BufRead .arch-inventory,=tagging-method setf arch
" ART*Enterprise (formerly ART-IM)
au BufNewFile,BufRead *.art setf art
" ASN.1
au BufNewFile,BufRead *.asn,*.asn1 setf asn
" Active Server Pages (with Visual Basic Script)
au BufNewFile,BufRead *.asa
\ if exists("g:filetype_asa") |
\ exe "setf " . g:filetype_asa |
\ else |
\ setf aspvbs |
\ endif
" Active Server Pages (with Perl or Visual Basic Script)
au BufNewFile,BufRead *.asp
\ if exists("g:filetype_asp") |
\ exe "setf " . g:filetype_asp |
\ elseif getline(1) . getline(2) . getline(3) =~? "perlscript" |
\ setf aspperl |
\ else |
\ setf aspvbs |
\ endif
" Grub (must be before catch *.lst)
au BufNewFile,BufRead /boot/grub/menu.lst,/boot/grub/grub.conf,/etc/grub.conf setf grub
" Assembly (all kinds)
" *.lst is not pure assembly, it has two extra columns (address, byte codes)
au BufNewFile,BufRead *.asm,*.[sS],*.[aA],*.mac,*.lst call s:FTasm()
" This function checks for the kind of assembly that is wanted by the user, or
" can be detected from the first five lines of the file.
func! s:FTasm()
" make sure b:asmsyntax exists
if !exists("b:asmsyntax")
let b:asmsyntax = ""
endif
if b:asmsyntax == ""
call s:FTasmsyntax()
endif
" if b:asmsyntax still isn't set, default to asmsyntax or GNU
if b:asmsyntax == ""
if exists("g:asmsyntax")
let b:asmsyntax = g:asmsyntax
else
let b:asmsyntax = "asm"
endif
endif
exe "setf " . fnameescape(b:asmsyntax)
endfunc
func! s:FTasmsyntax()
" see if file contains any asmsyntax=foo overrides. If so, change
" b:asmsyntax appropriately
let head = " ".getline(1)." ".getline(2)." ".getline(3)." ".getline(4).
\" ".getline(5)." "
let match = matchstr(head, '\sasmsyntax=\zs[a-zA-Z0-9]\+\ze\s')
if match != ''
let b:asmsyntax = match
elseif ((head =~? '\.title') || (head =~? '\.ident') || (head =~? '\.macro') || (head =~? '\.subtitle') || (head =~? '\.library'))
let b:asmsyntax = "vmasm"
endif
endfunc
" Macro (VAX)
au BufNewFile,BufRead *.mar setf vmasm
" Atlas
au BufNewFile,BufRead *.atl,*.as setf atlas
" Autoit v3
au BufNewFile,BufRead *.au3 setf autoit
" Autohotkey
au BufNewFile,BufRead *.ahk setf autohotkey
" Automake
au BufNewFile,BufRead [mM]akefile.am,GNUmakefile.am setf automake
" Autotest .at files are actually m4
au BufNewFile,BufRead *.at setf m4
" Avenue
au BufNewFile,BufRead *.ave setf ave
" Awk
au BufNewFile,BufRead *.awk setf awk
" B
au BufNewFile,BufRead *.mch,*.ref,*.imp setf b
" BASIC or Visual Basic
au BufNewFile,BufRead *.bas call s:FTVB("basic")
" Check if one of the first five lines contains "VB_Name". In that case it is
" probably a Visual Basic file. Otherwise it's assumed to be "alt" filetype.
func! s:FTVB(alt)
if getline(1).getline(2).getline(3).getline(4).getline(5) =~? 'VB_Name\|Begin VB\.\(Form\|MDIForm\|UserControl\)'
setf vb
else
exe "setf " . a:alt
endif
endfunc
" Visual Basic Script (close to Visual Basic)
au BufNewFile,BufRead *.vbs,*.dsm,*.ctl setf vb
" IBasic file (similar to QBasic)
au BufNewFile,BufRead *.iba,*.ibi setf ibasic
" FreeBasic file (similar to QBasic)
au BufNewFile,BufRead *.fb,*.bi setf freebasic
" Batch file for MSDOS.
au BufNewFile,BufRead *.bat,*.sys setf dosbatch
" *.cmd is close to a Batch file, but on OS/2 Rexx files also use *.cmd.
au BufNewFile,BufRead *.cmd
\ if getline(1) =~ '^/\*' | setf rexx | else | setf dosbatch | endif
" Batch file for 4DOS
au BufNewFile,BufRead *.btm call s:FTbtm()
func! s:FTbtm()
if exists("g:dosbatch_syntax_for_btm") && g:dosbatch_syntax_for_btm
setf dosbatch
else
setf btm
endif
endfunc
" BC calculator
au BufNewFile,BufRead *.bc setf bc
" BDF font
au BufNewFile,BufRead *.bdf setf bdf
" BibTeX bibliography database file
au BufNewFile,BufRead *.bib setf bib
" BibTeX Bibliography Style
au BufNewFile,BufRead *.bst setf bst
" BIND configuration
au BufNewFile,BufRead named.conf,rndc.conf setf named
" BIND zone
au BufNewFile,BufRead named.root setf bindzone
au BufNewFile,BufRead *.db call s:BindzoneCheck('')
func! s:BindzoneCheck(default)
if getline(1).getline(2).getline(3).getline(4) =~ '^; <<>> DiG [0-9.]\+ <<>>\|BIND.*named\|$ORIGIN\|$TTL\|IN\s\+SOA'
setf bindzone
elseif a:default != ''
exe 'setf ' . a:default
endif
endfunc
" Blank
au BufNewFile,BufRead *.bl setf blank
" Blkid cache file
au BufNewFile,BufRead /etc/blkid.tab,/etc/blkid.tab.old setf xml
" C or lpc
au BufNewFile,BufRead *.c call s:FTlpc()
func! s:FTlpc()
if exists("g:lpc_syntax_for_c")
let lnum = 1
while lnum <= 12
if getline(lnum) =~# '^\(//\|inherit\|private\|protected\|nosave\|string\|object\|mapping\|mixed\)'
setf lpc
return
endif
let lnum = lnum + 1
endwhile
endif
setf c
endfunc
" Calendar
au BufNewFile,BufRead calendar setf calendar
au BufNewFile,BufRead */.calendar/*,
\*/share/calendar/*/calendar.*,*/share/calendar/calendar.*
\ call s:StarSetf('calendar')
" C#
au BufNewFile,BufRead *.cs setf cs
" Cabal
au BufNewFile,BufRead *.cabal setf cabal
" Cdrdao TOC
au BufNewFile,BufRead *.toc setf cdrtoc
" Cdrdao config
au BufNewFile,BufRead etc/cdrdao.conf,etc/defaults/cdrdao,etc/default/cdrdao,~/.cdrdao setf cdrdaoconf
" Cfengine
au BufNewFile,BufRead cfengine.conf setf cfengine
" ChaiScript
au BufRead,BufNewFile *.chai setf chaiscript
" Comshare Dimension Definition Language
au BufNewFile,BufRead *.cdl setf cdl
" Conary Recipe
au BufNewFile,BufRead *.recipe setf conaryrecipe
" Controllable Regex Mutilator
au BufNewFile,BufRead *.crm setf crm
" Cyn++
au BufNewFile,BufRead *.cyn setf cynpp
" Cynlib
" .cc and .cpp files can be C++ or Cynlib.
au BufNewFile,BufRead *.cc
\ if exists("cynlib_syntax_for_cc")|setf cynlib|else|setf cpp|endif
au BufNewFile,BufRead *.cpp
\ if exists("cynlib_syntax_for_cpp")|setf cynlib|else|setf cpp|endif
" C++
au BufNewFile,BufRead *.cxx,*.c++,*.hh,*.hxx,*.hpp,*.ipp,*.moc,*.tcc,*.inl setf cpp
if has("fname_case")
au BufNewFile,BufRead *.C,*.H setf cpp
endif
" .h files can be C, Ch C++, ObjC or ObjC++.
" Set c_syntax_for_h if you want C, ch_syntax_for_h if you want Ch. ObjC is
" detected automatically.
au BufNewFile,BufRead *.h call s:FTheader()
func! s:FTheader()
if match(getline(1, min([line("$"), 200])), '^@\(interface\|end\|class\)') > -1
setf objc
elseif exists("g:c_syntax_for_h")
setf c
elseif exists("g:ch_syntax_for_h")
setf ch
else
setf cpp
endif
endfunc
" Ch (CHscript)
au BufNewFile,BufRead *.chf setf ch
" TLH files are C++ headers generated by Visual C++'s #import from typelibs
au BufNewFile,BufRead *.tlh setf cpp
" Cascading Style Sheets
au BufNewFile,BufRead *.css setf css
" Century Term Command Scripts (*.cmd too)
au BufNewFile,BufRead *.con setf cterm
" Changelog
au BufNewFile,BufRead changelog.Debian,changelog.dch,NEWS.Debian,NEWS.dch
\ setf debchangelog
au BufNewFile,BufRead [cC]hange[lL]og
\ if getline(1) =~ '; urgency='
\| setf debchangelog
\| else
\| setf changelog
\| endif
au BufNewFile,BufRead NEWS
\ if getline(1) =~ '; urgency='
\| setf debchangelog
\| endif
" CHILL
au BufNewFile,BufRead *..ch setf chill
" Changes for WEB and CWEB or CHILL
au BufNewFile,BufRead *.ch call s:FTchange()
" This function checks if one of the first ten lines start with a '@'. In
" that case it is probably a change file.
" If the first line starts with # or ! it's probably a ch file.
" If a line has "main", "include", "//" ir "/*" it's probably ch.
" Otherwise CHILL is assumed.
func! s:FTchange()
let lnum = 1
while lnum <= 10
if getline(lnum)[0] == '@'
setf change
return
endif
if lnum == 1 && (getline(1)[0] == '#' || getline(1)[0] == '!')
setf ch
return
endif
if getline(lnum) =~ "MODULE"
setf chill
return
endif
if getline(lnum) =~ 'main\s*(\|#\s*include\|//'
setf ch
return
endif
let lnum = lnum + 1
endwhile
setf chill
endfunc
" ChordPro
au BufNewFile,BufRead *.chopro,*.crd,*.cho,*.crdpro,*.chordpro setf chordpro
" Clean
au BufNewFile,BufRead *.dcl,*.icl setf clean
" Clever
au BufNewFile,BufRead *.eni setf cl
" Clever or dtd
au BufNewFile,BufRead *.ent call s:FTent()
func! s:FTent()
" This function checks for valid cl syntax in the first five lines.
" Look for either an opening comment, '#', or a block start, '{".
" If not found, assume SGML.
let lnum = 1
while lnum < 6
let line = getline(lnum)
if line =~ '^\s*[#{]'
setf cl
return
elseif line !~ '^\s*$'
" Not a blank line, not a comment, and not a block start,
" so doesn't look like valid cl code.
break
endif
let lnum = lnum + 1
endw
setf dtd
endfunc
" Clipper (or FoxPro; could also be eviews)
au BufNewFile,BufRead *.prg
\ if exists("g:filetype_prg") |
\ exe "setf " . g:filetype_prg |
\ else |
\ setf clipper |
\ endif
" Cmake
au BufNewFile,BufRead CMakeLists.txt,*.cmake,*.cmake.in setf cmake
" Cmusrc
au BufNewFile,BufRead ~/.cmus/{autosave,rc,command-history,*.theme} setf cmusrc
au BufNewFile,BufRead */cmus/{rc,*.theme} setf cmusrc
" Cobol
au BufNewFile,BufRead *.cbl,*.cob,*.lib setf cobol
" cobol or zope form controller python script? (heuristic)
au BufNewFile,BufRead *.cpy
\ if getline(1) =~ '^##' |
\ setf python |
\ else |
\ setf cobol |
\ endif
" Coco/R
au BufNewFile,BufRead *.atg setf coco
" Cold Fusion
au BufNewFile,BufRead *.cfm,*.cfi,*.cfc setf cf
" Configure scripts
au BufNewFile,BufRead configure.in,configure.ac setf config
" CUDA Cumpute Unified Device Architecture
au BufNewFile,BufRead *.cu setf cuda
" WildPackets EtherPeek Decoder
au BufNewFile,BufRead *.dcd setf dcd
" Enlightenment configuration files
au BufNewFile,BufRead *enlightenment/*.cfg setf c
" Eterm
au BufNewFile,BufRead *Eterm/*.cfg setf eterm
" Lynx config files
au BufNewFile,BufRead lynx.cfg setf lynx
" Quake
au BufNewFile,BufRead *baseq[2-3]/*.cfg,*id1/*.cfg setf quake
au BufNewFile,BufRead *quake[1-3]/*.cfg setf quake
" Quake C
au BufNewFile,BufRead *.qc setf c
" Configure files
au BufNewFile,BufRead *.cfg setf cfg
" Cucumber
au BufNewFile,BufRead *.feature setf cucumber
" Communicating Sequential Processes
au BufNewFile,BufRead *.csp,*.fdr setf csp
" CUPL logic description and simulation
au BufNewFile,BufRead *.pld setf cupl
au BufNewFile,BufRead *.si setf cuplsim
" Debian Control
au BufNewFile,BufRead */debian/control setf debcontrol
au BufNewFile,BufRead control
\ if getline(1) =~ '^Source:'
\| setf debcontrol
\| endif
" Debian Sources.list
au BufNewFile,BufRead /etc/apt/sources.list setf debsources
" Deny hosts
au BufNewFile,BufRead denyhosts.conf setf denyhosts
" ROCKLinux package description
au BufNewFile,BufRead *.desc setf desc
" the D language or dtrace
au BufNewFile,BufRead *.d call s:DtraceCheck()
func! s:DtraceCheck()
let lines = getline(1, min([line("$"), 100]))
if match(lines, '^#!\S\+dtrace\|#pragma\s\+D\s\+option\|:\S\{-}:\S\{-}:') > -1
setf dtrace
else
setf d
endif
endfunc
" Desktop files
au BufNewFile,BufRead *.desktop,.directory setf desktop
" Dict config
au BufNewFile,BufRead dict.conf,.dictrc setf dictconf
" Dictd config
au BufNewFile,BufRead dictd.conf setf dictdconf
" Diff files
au BufNewFile,BufRead *.diff,*.rej,*.patch setf diff
" Dircolors
au BufNewFile,BufRead .dir_colors,/etc/DIR_COLORS setf dircolors
" Diva (with Skill) or InstallShield
au BufNewFile,BufRead *.rul
\ if getline(1).getline(2).getline(3).getline(4).getline(5).getline(6) =~? 'InstallShield' |
\ setf ishd |
\ else |
\ setf diva |
\ endif
" DCL (Digital Command Language - vms) or DNS zone file
au BufNewFile,BufRead *.com call s:BindzoneCheck('dcl')
" DOT
au BufNewFile,BufRead *.dot setf dot
" Dylan - lid files
au BufNewFile,BufRead *.lid setf dylanlid
" Dylan - intr files (melange)
au BufNewFile,BufRead *.intr setf dylanintr
" Dylan
au BufNewFile,BufRead *.dylan setf dylan
" Microsoft Module Definition
au BufNewFile,BufRead *.def setf def
" Dracula
au BufNewFile,BufRead *.drac,*.drc,*lvs,*lpe setf dracula
" Datascript
au BufNewFile,BufRead *.ds setf datascript
" dsl
au BufNewFile,BufRead *.dsl setf dsl
" DTD (Document Type Definition for XML)
au BufNewFile,BufRead *.dtd setf dtd
" EDIF (*.edf,*.edif,*.edn,*.edo)
au BufNewFile,BufRead *.ed\(f\|if\|n\|o\) setf edif
" Embedix Component Description
au BufNewFile,BufRead *.ecd setf ecd
" Eiffel or Specman
au BufNewFile,BufRead *.e,*.E call s:FTe()
" Elinks configuration
au BufNewFile,BufRead */etc/elinks.conf,*/.elinks/elinks.conf setf elinks
func! s:FTe()
let n = 1
while n < 100 && n < line("$")
if getline(n) =~ "^\\s*\\(<'\\|'>\\)\\s*$"
setf specman
return
endif
let n = n + 1
endwhile
setf eiffel
endfunc
" ERicsson LANGuage; Yaws is erlang too
au BufNewFile,BufRead *.erl,*.hrl,*.yaws setf erlang
" Elm Filter Rules file
au BufNewFile,BufRead filter-rules setf elmfilt
" ESMTP rc file
au BufNewFile,BufRead *esmtprc setf esmtprc
" ESQL-C
au BufNewFile,BufRead *.ec,*.EC setf esqlc
" Esterel
au BufNewFile,BufRead *.strl setf esterel
" Essbase script
au BufNewFile,BufRead *.csc setf csc
" Exim
au BufNewFile,BufRead exim.conf setf exim
" Expect
au BufNewFile,BufRead *.exp setf expect
" Exports
au BufNewFile,BufRead exports setf exports
" Falcon
au BufNewFile,BufRead *.fal setf falcon
" Fantom
au BufNewFile,BufRead *.fan,*.fwt setf fan
" Factor
au BufNewFile,BufRead *.factor setf factor
" Fetchmail RC file
au BufNewFile,BufRead .fetchmailrc setf fetchmail
" FlexWiki - disabled, because it has side effects when a .wiki file
" is not actually FlexWiki
"au BufNewFile,BufRead *.wiki setf flexwiki
" Focus Executable
au BufNewFile,BufRead *.fex,*.focexec setf focexec
" Focus Master file (but not for auto.master)
au BufNewFile,BufRead auto.master setf conf
au BufNewFile,BufRead *.mas,*.master setf master
" Forth
au BufNewFile,BufRead *.fs,*.ft setf forth
" Reva Forth
au BufNewFile,BufRead *.frt setf reva
" Fortran
if has("fname_case")
au BufNewFile,BufRead *.F,*.FOR,*.FPP,*.FTN,*.F77,*.F90,*.F95,*.F03,*.F08 setf fortran
endif
au BufNewFile,BufRead *.f,*.for,*.fortran,*.fpp,*.ftn,*.f77,*.f90,*.f95,*.f03,*.f08 setf fortran
" Framescript
au BufNewFile,BufRead *.fsl setf framescript
" FStab
au BufNewFile,BufRead fstab,mtab setf fstab
" GDB command files
au BufNewFile,BufRead .gdbinit setf gdb
" GDMO
au BufNewFile,BufRead *.mo,*.gdmo setf gdmo
" Gedcom
au BufNewFile,BufRead *.ged,lltxxxxx.txt setf gedcom
" Git
autocmd BufNewFile,BufRead *.git/COMMIT_EDITMSG setf gitcommit
autocmd BufNewFile,BufRead *.git/config,.gitconfig,.gitmodules setf gitconfig
autocmd BufNewFile,BufRead git-rebase-todo setf gitrebase
autocmd BufNewFile,BufRead .msg.[0-9]*
\ if getline(1) =~ '^From.*# This line is ignored.$' |
\ setf gitsendemail |
\ endif
autocmd BufNewFile,BufRead *.git/**
\ if getline(1) =~ '^\x\{40\}\>\|^ref: ' |
\ setf git |
\ endif
" Gkrellmrc
au BufNewFile,BufRead gkrellmrc,gkrellmrc_? setf gkrellmrc
" GP scripts (2.0 and onward)
au BufNewFile,BufRead *.gp,.gprc setf gp
" GPG
au BufNewFile,BufRead */.gnupg/options setf gpg
au BufNewFile,BufRead */.gnupg/gpg.conf setf gpg
au BufNewFile,BufRead /usr/**/gnupg/options.skel setf gpg
" Gnuplot scripts
au BufNewFile,BufRead *.gpi setf gnuplot
" GrADS scripts
au BufNewFile,BufRead *.gs setf grads
" Gretl
au BufNewFile,BufRead *.gretl setf gretl
" Groovy
au BufNewFile,BufRead *.groovy setf groovy
" GNU Server Pages
au BufNewFile,BufRead *.gsp setf gsp
" Group file
au BufNewFile,BufRead /etc/group,/etc/group-,/etc/group.edit,/etc/gshadow,/etc/gshadow-,/etc/gshadow.edit,/var/backups/group.bak,/var/backups/gshadow.bak setf group
" GTK RC
au BufNewFile,BufRead .gtkrc,gtkrc setf gtkrc
" Haml
au BufNewFile,BufRead *.haml setf haml
" Hamster Classic | Playground files
au BufNewFile,BufRead *.hsc,*.hsm setf hamster
" Haskell
au BufNewFile,BufRead *.hs,*.hs-boot setf haskell
au BufNewFile,BufRead *.lhs setf lhaskell
au BufNewFile,BufRead *.chs setf chaskell
" Haste
au BufNewFile,BufRead *.ht setf haste
au BufNewFile,BufRead *.htpp setf hastepreproc
" Hercules
au BufNewFile,BufRead *.vc,*.ev,*.rs,*.sum,*.errsum setf hercules
" HEX (Intel)
au BufNewFile,BufRead *.hex,*.h32 setf hex
" Tilde (must be before HTML)
au BufNewFile,BufRead *.t.html setf tilde
" HTML (.shtml and .stm for server side)
au BufNewFile,BufRead *.html,*.htm,*.shtml,*.stm call s:FThtml()
" Distinguish between HTML, XHTML and Django
func! s:FThtml()
let n = 1
while n < 10 && n < line("$")
if getline(n) =~ '\<DTD\s\+XHTML\s'
setf xhtml
return
endif
if getline(n) =~ '{%\s*\(extends\|block\)\>'
setf htmldjango
return
endif
let n = n + 1
endwhile
setf html
endfunc
" HTML with Ruby - eRuby
au BufNewFile,BufRead *.erb,*.rhtml setf eruby
" HTML with M4
au BufNewFile,BufRead *.html.m4 setf htmlm4
" HTML Cheetah template
au BufNewFile,BufRead *.tmpl setf htmlcheetah
" Host config
au BufNewFile,BufRead /etc/host.conf setf hostconf
" Hosts access
au BufNewFile,BufRead /etc/hosts.allow,/etc/hosts.deny setf hostsaccess
" Hyper Builder
au BufNewFile,BufRead *.hb setf hb
" Icon
au BufNewFile,BufRead *.icn setf icon
" IDL (Interface Description Language)
au BufNewFile,BufRead *.idl call s:FTidl()
" Distinguish between standard IDL and MS-IDL
func! s:FTidl()
let n = 1
while n < 50 && n < line("$")
if getline(n) =~ '^\s*import\s\+"\(unknwn\|objidl\)\.idl"'
setf msidl
return
endif
let n = n + 1
endwhile
setf idl
endfunc
" Microsoft IDL (Interface Description Language) Also *.idl
" MOF = WMI (Windows Management Instrumentation) Managed Object Format
au BufNewFile,BufRead *.odl,*.mof setf msidl
" Icewm menu
au BufNewFile,BufRead */.icewm/menu setf icemenu
" Indent profile (must come before IDL *.pro!)
au BufNewFile,BufRead .indent.pro setf indent
au BufNewFile,BufRead indent.pro call s:ProtoCheck('indent')
" IDL (Interactive Data Language)
au BufNewFile,BufRead *.pro call s:ProtoCheck('idlang')
" Distinguish between "default" and Cproto prototype file. */
func! s:ProtoCheck(default)
" Cproto files have a comment in the first line and a function prototype in
" the second line, it always ends in ";". Indent files may also have
" comments, thus we can't match comments to see the difference.
if getline(2) =~ ';$'
setf cpp
else
exe 'setf ' . a:default
endif
endfunc
" Indent RC
au BufNewFile,BufRead indentrc setf indent
" Inform
au BufNewFile,BufRead *.inf,*.INF setf inform
" Initng
au BufNewFile,BufRead /etc/initng/**/*.i,*.ii setf initng
" Ipfilter
au BufNewFile,BufRead ipf.conf,ipf6.conf,ipf.rules setf ipfilter
" Informix 4GL (source - canonical, include file, I4GL+M4 preproc.)
au BufNewFile,BufRead *.4gl,*.4gh,*.m4gl setf fgl
" .INI file for MSDOS
au BufNewFile,BufRead *.ini setf dosini
" SysV Inittab
au BufNewFile,BufRead inittab setf inittab
" Inno Setup
au BufNewFile,BufRead *.iss setf iss
" JAL
au BufNewFile,BufRead *.jal,*.JAL setf jal
" Jam
au BufNewFile,BufRead *.jpl,*.jpr setf jam
" Java
au BufNewFile,BufRead *.java,*.jav setf java
" JavaCC
au BufNewFile,BufRead *.jj,*.jjt setf javacc
" JavaScript, ECMAScript
au BufNewFile,BufRead *.js,*.javascript,*.es,*.jsx setf javascript
" Java Server Pages
au BufNewFile,BufRead *.jsp setf jsp
" Java Properties resource file (note: doesn't catch font.properties.pl)
au BufNewFile,BufRead *.properties,*.properties_??,*.properties_??_?? setf jproperties
au BufNewFile,BufRead *.properties_??_??_* call s:StarSetf('jproperties')
" Jess
au BufNewFile,BufRead *.clp setf jess
" Jgraph
au BufNewFile,BufRead *.jgr setf jgraph
" Kixtart
au BufNewFile,BufRead *.kix setf kix
" Kimwitu[++]
au BufNewFile,BufRead *.k setf kwt
" KDE script
au BufNewFile,BufRead *.ks setf kscript
" Kconfig
au BufNewFile,BufRead Kconfig,Kconfig.debug setf kconfig
" Lace (ISE)
au BufNewFile,BufRead *.ace,*.ACE setf lace
" Latte
au BufNewFile,BufRead *.latte,*.lte setf latte
" Limits
au BufNewFile,BufRead /etc/limits setf limits
" LambdaProlog (*.mod too, see Modsim)
au BufNewFile,BufRead *.sig setf lprolog
" LDAP LDIF
au BufNewFile,BufRead *.ldif setf ldif
" Ld loader
au BufNewFile,BufRead *.ld setf ld
" Lex
au BufNewFile,BufRead *.lex,*.l setf lex
" Libao
au BufNewFile,BufRead /etc/libao.conf,*/.libao setf libao
" Libsensors
au BufNewFile,BufRead /etc/sensors.conf setf sensors
" LFTP
au BufNewFile,BufRead lftp.conf,.lftprc,*lftp/rc setf lftp
" Lifelines (or Lex for C++!)
au BufNewFile,BufRead *.ll setf lifelines
" Lilo: Linux loader
au BufNewFile,BufRead lilo.conf* call s:StarSetf('lilo')
" Lisp (*.el = ELisp, *.cl = Common Lisp, *.jl = librep Lisp)
if has("fname_case")
au BufNewFile,BufRead *.lsp,*.lisp,*.el,*.cl,*.jl,*.L,.emacs,.sawfishrc setf lisp
else
au BufNewFile,BufRead *.lsp,*.lisp,*.el,*.cl,*.jl,.emacs,.sawfishrc setf lisp
endif
" SBCL implementation of Common Lisp
au BufNewFile,BufRead sbclrc,.sbclrc setf lisp
" Liquid
au BufNewFile,BufRead *.liquid setf liquid
" Lite
au BufNewFile,BufRead *.lite,*.lt setf lite
" LiteStep RC files
au BufNewFile,BufRead */LiteStep/*/*.rc setf litestep