Skip to content

Commit 643a6d0

Browse files
committed
De-duplicate runtime heuristic autocommands
1 parent f678aad commit 643a6d0

File tree

2 files changed

+34
-34
lines changed

2 files changed

+34
-34
lines changed

autoload/polyglot/init.vim

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ if !has_key(g:polyglot_is_disabled, 'xpm2')
196196
endif
197197

198198
if !has_key(g:polyglot_is_disabled, 'xpm')
199-
au BufNewFile,BufRead,BufWritePost *.pm call polyglot#detect#Pm()
199+
au! BufNewFile,BufRead,BufWritePost *.pm call polyglot#detect#Pm()
200200
au BufNewFile,BufRead *.xpm setf xpm
201201
endif
202202

@@ -1323,7 +1323,7 @@ if !has_key(g:polyglot_is_disabled, 'tilde')
13231323
endif
13241324

13251325
if !has_key(g:polyglot_is_disabled, 'html')
1326-
au BufNewFile,BufRead,BufWritePost *.html call polyglot#detect#Html()
1326+
au! BufNewFile,BufRead,BufWritePost *.html call polyglot#detect#Html()
13271327
au BufNewFile,BufRead *.htm,*.html.hl,*.inc,*.xht,*.xhtml setf html
13281328
endif
13291329

@@ -1785,11 +1785,11 @@ if !has_key(g:polyglot_is_disabled, 'gitignore')
17851785
endif
17861786

17871787
if !has_key(g:polyglot_is_disabled, 'tads')
1788-
au BufNewFile,BufRead,BufWritePost *.t call polyglot#detect#T()
1788+
au! BufNewFile,BufRead,BufWritePost *.t call polyglot#detect#T()
17891789
endif
17901790

17911791
if !has_key(g:polyglot_is_disabled, 'prolog')
1792-
au BufNewFile,BufRead,BufWritePost *.pl call polyglot#detect#Pl()
1792+
au! BufNewFile,BufRead,BufWritePost *.pl call polyglot#detect#Pl()
17931793
au BufNewFile,BufRead *.pdb,*.pro,*.prolog,*.yap setf prolog
17941794
endif
17951795

@@ -1812,7 +1812,7 @@ if !has_key(g:polyglot_is_disabled, 'spec')
18121812
endif
18131813

18141814
if !has_key(g:polyglot_is_disabled, 'visual-basic')
1815-
au BufNewFile,BufRead,BufWritePost *.bas call polyglot#detect#Bas()
1815+
au! BufNewFile,BufRead,BufWritePost *.bas call polyglot#detect#Bas()
18161816
au BufNewFile,BufRead *.cls,*.ctl,*.dsm,*.frm,*.frx,*.sba,*.vba,*.vbs setf vb
18171817
endif
18181818

@@ -1821,7 +1821,7 @@ if !has_key(g:polyglot_is_disabled, 'basic')
18211821
endif
18221822

18231823
if !has_key(g:polyglot_is_disabled, 'trasys')
1824-
au BufNewFile,BufRead,BufWritePost *.inp call polyglot#detect#Inp()
1824+
au! BufNewFile,BufRead,BufWritePost *.inp call polyglot#detect#Inp()
18251825
endif
18261826

18271827
if !has_key(g:polyglot_is_disabled, 'zig')
@@ -2013,7 +2013,7 @@ if !has_key(g:polyglot_is_disabled, 'rst')
20132013
endif
20142014

20152015
if !has_key(g:polyglot_is_disabled, 'reason')
2016-
au BufNewFile,BufRead,BufWritePost *.re call polyglot#detect#Re()
2016+
au! BufNewFile,BufRead,BufWritePost *.re call polyglot#detect#Re()
20172017
au BufNewFile,BufRead *.rei setf reason
20182018
endif
20192019

@@ -2026,9 +2026,9 @@ if !has_key(g:polyglot_is_disabled, 'raml')
20262026
endif
20272027

20282028
if !has_key(g:polyglot_is_disabled, 'raku')
2029-
au BufNewFile,BufRead,BufWritePost *.t call polyglot#detect#T()
2030-
au BufNewFile,BufRead,BufWritePost *.pm call polyglot#detect#Pm()
2031-
au BufNewFile,BufRead,BufWritePost *.pl call polyglot#detect#Pl()
2029+
au! BufNewFile,BufRead,BufWritePost *.t call polyglot#detect#T()
2030+
au! BufNewFile,BufRead,BufWritePost *.pm call polyglot#detect#Pm()
2031+
au! BufNewFile,BufRead,BufWritePost *.pl call polyglot#detect#Pl()
20322032
au BufNewFile,BufRead *.6pl,*.6pm,*.nqp,*.p6,*.p6l,*.p6m,*.pl6,*.pm6,*.pod6,*.raku,*.rakudoc,*.rakumod,*.rakutest,*.t6 setf raku
20332033
endif
20342034

@@ -2112,14 +2112,14 @@ if !has_key(g:polyglot_is_disabled, 'pgsql')
21122112
endif
21132113

21142114
if !has_key(g:polyglot_is_disabled, 'perl')
2115-
au BufNewFile,BufRead,BufWritePost *.t call polyglot#detect#T()
2116-
au BufNewFile,BufRead,BufWritePost *.pm call polyglot#detect#Pm()
2117-
au BufNewFile,BufRead,BufWritePost *.pl call polyglot#detect#Pl()
2115+
au! BufNewFile,BufRead,BufWritePost *.t call polyglot#detect#T()
2116+
au! BufNewFile,BufRead,BufWritePost *.pm call polyglot#detect#Pm()
2117+
au! BufNewFile,BufRead,BufWritePost *.pl call polyglot#detect#Pl()
21182118
au BufNewFile,BufRead *.al,*.cgi,*.fcgi,*.perl,*.ph,*.plx,*.psgi,{.,}gitolite.rc,Makefile.PL,Rexfile,ack,cpanfile,example.gitolite.rc setf perl
21192119
au BufNewFile,BufRead *.pod setf pod
21202120
au BufNewFile,BufRead *.comp,*.mason,*.mhtml setf mason
2121-
au BufNewFile,BufRead,BufWritePost *.tt2 call polyglot#detect#Tt2()
2122-
au BufNewFile,BufRead,BufWritePost *.tt2 call polyglot#detect#Tt2()
2121+
au! BufNewFile,BufRead,BufWritePost *.tt2 call polyglot#detect#Tt2()
2122+
au! BufNewFile,BufRead,BufWritePost *.tt2 call polyglot#detect#Tt2()
21232123
au BufNewFile,BufRead *.xs setf xs
21242124
endif
21252125

@@ -2132,7 +2132,7 @@ if !has_key(g:polyglot_is_disabled, 'opencl')
21322132
endif
21332133

21342134
if !has_key(g:polyglot_is_disabled, 'octave')
2135-
au BufNewFile,BufRead,BufWritePost *.m call polyglot#detect#M()
2135+
au! BufNewFile,BufRead,BufWritePost *.m call polyglot#detect#M()
21362136
au BufNewFile,BufRead *.oct setf octave
21372137
endif
21382138

@@ -2149,8 +2149,8 @@ if !has_key(g:polyglot_is_disabled, 'ocaml')
21492149
endif
21502150

21512151
if !has_key(g:polyglot_is_disabled, 'objc')
2152-
au BufNewFile,BufRead,BufWritePost *.m call polyglot#detect#M()
2153-
au BufNewFile,BufRead,BufWritePost *.h call polyglot#detect#H()
2152+
au! BufNewFile,BufRead,BufWritePost *.m call polyglot#detect#M()
2153+
au! BufNewFile,BufRead,BufWritePost *.h call polyglot#detect#H()
21542154
endif
21552155

21562156
if !has_key(g:polyglot_is_disabled, 'nix')
@@ -2168,7 +2168,7 @@ if !has_key(g:polyglot_is_disabled, 'nginx')
21682168
endif
21692169

21702170
if !has_key(g:polyglot_is_disabled, 'murphi')
2171-
au BufNewFile,BufRead,BufWritePost *.m call polyglot#detect#M()
2171+
au! BufNewFile,BufRead,BufWritePost *.m call polyglot#detect#M()
21722172
endif
21732173

21742174
if !has_key(g:polyglot_is_disabled, 'moonscript')
@@ -2185,7 +2185,7 @@ if !has_key(g:polyglot_is_disabled, 'mdx')
21852185
endif
21862186

21872187
if !has_key(g:polyglot_is_disabled, 'mathematica')
2188-
au BufNewFile,BufRead,BufWritePost *.m call polyglot#detect#M()
2188+
au! BufNewFile,BufRead,BufWritePost *.m call polyglot#detect#M()
21892189
au BufNewFile,BufRead *.cdf,*.ma,*.mathematica,*.mma,*.mt,*.nb,*.nbp,*.wl,*.wls,*.wlt setf mma
21902190
endif
21912191

@@ -2273,14 +2273,14 @@ if !has_key(g:polyglot_is_disabled, 'ion')
22732273
endif
22742274

22752275
if !has_key(g:polyglot_is_disabled, 'idris2')
2276-
au BufNewFile,BufRead,BufWritePost *.idr call polyglot#detect#Idr()
2276+
au! BufNewFile,BufRead,BufWritePost *.idr call polyglot#detect#Idr()
22772277
au BufNewFile,BufRead *.ipkg,idris-response setf idris2
2278-
au BufNewFile,BufRead,BufWritePost *.lidr call polyglot#detect#Lidr()
2278+
au! BufNewFile,BufRead,BufWritePost *.lidr call polyglot#detect#Lidr()
22792279
endif
22802280

22812281
if !has_key(g:polyglot_is_disabled, 'idris')
2282-
au BufNewFile,BufRead,BufWritePost *.lidr call polyglot#detect#Lidr()
2283-
au BufNewFile,BufRead,BufWritePost *.idr call polyglot#detect#Idr()
2282+
au! BufNewFile,BufRead,BufWritePost *.lidr call polyglot#detect#Lidr()
2283+
au! BufNewFile,BufRead,BufWritePost *.idr call polyglot#detect#Idr()
22842284
au BufNewFile,BufRead idris-response setf idris
22852285
endif
22862286

@@ -2360,7 +2360,7 @@ if !has_key(g:polyglot_is_disabled, 'gmpl')
23602360
endif
23612361

23622362
if !has_key(g:polyglot_is_disabled, 'glsl')
2363-
au BufNewFile,BufRead,BufWritePost *.fs call polyglot#detect#Fs()
2363+
au! BufNewFile,BufRead,BufWritePost *.fs call polyglot#detect#Fs()
23642364
au BufNewFile,BufRead *.comp,*.fp,*.frag,*.frg,*.fsh,*.fshader,*.geo,*.geom,*.glsl,*.glslf,*.glslv,*.gs,*.gshader,*.shader,*.tesc,*.tese,*.vert,*.vrx,*.vsh,*.vshader setf glsl
23652365
endif
23662366

@@ -2377,12 +2377,12 @@ if !has_key(g:polyglot_is_disabled, 'gdscript')
23772377
endif
23782378

23792379
if !has_key(g:polyglot_is_disabled, 'fsharp')
2380-
au BufNewFile,BufRead,BufWritePost *.fs call polyglot#detect#Fs()
2380+
au! BufNewFile,BufRead,BufWritePost *.fs call polyglot#detect#Fs()
23812381
au BufNewFile,BufRead *.fsi,*.fsx setf fsharp
23822382
endif
23832383

23842384
if !has_key(g:polyglot_is_disabled, 'forth')
2385-
au BufNewFile,BufRead,BufWritePost *.fs call polyglot#detect#Fs()
2385+
au! BufNewFile,BufRead,BufWritePost *.fs call polyglot#detect#Fs()
23862386
au BufNewFile,BufRead *.ft,*.fth setf forth
23872387
endif
23882388

@@ -2514,12 +2514,12 @@ if !has_key(g:polyglot_is_disabled, 'atlas')
25142514
endif
25152515

25162516
if !has_key(g:polyglot_is_disabled, 'aspperl')
2517-
au BufNewFile,BufRead,BufWritePost *.asp call polyglot#detect#Asp()
2517+
au! BufNewFile,BufRead,BufWritePost *.asp call polyglot#detect#Asp()
25182518
endif
25192519

25202520
if !has_key(g:polyglot_is_disabled, 'aspvbs')
2521-
au BufNewFile,BufRead,BufWritePost *.asp call polyglot#detect#Asp()
2522-
au BufNewFile,BufRead,BufWritePost *.asa call polyglot#detect#Asa()
2521+
au! BufNewFile,BufRead,BufWritePost *.asp call polyglot#detect#Asp()
2522+
au! BufNewFile,BufRead,BufWritePost *.asa call polyglot#detect#Asa()
25232523
endif
25242524

25252525
if !has_key(g:polyglot_is_disabled, 'asn')
@@ -2555,9 +2555,9 @@ if !has_key(g:polyglot_is_disabled, 'arduino')
25552555
endif
25562556

25572557
if !has_key(g:polyglot_is_disabled, 'c/c++')
2558-
au BufNewFile,BufRead,BufWritePost *.h call polyglot#detect#H()
2558+
au! BufNewFile,BufRead,BufWritePost *.h call polyglot#detect#H()
25592559
au BufNewFile,BufRead *.c++,*.cc,*.cp,*.cpp,*.cxx,*.h++,*.hh,*.hpp,*.hxx,*.inc,*.inl,*.ipp,*.moc,*.tcc,*.tlh,*.tpp setf cpp
2560-
au BufNewFile,BufRead,BufWritePost *.h call polyglot#detect#H()
2560+
au! BufNewFile,BufRead,BufWritePost *.h call polyglot#detect#H()
25612561
au BufNewFile,BufRead *.c,*.cats,*.idc,*.qc,*enlightenment/*.cfg setf c
25622562
endif
25632563

@@ -2660,7 +2660,7 @@ if !has_key(g:polyglot_is_disabled, 'abc')
26602660
endif
26612661

26622662
if !has_key(g:polyglot_is_disabled, 'abaqus')
2663-
au BufNewFile,BufRead,BufWritePost *.inp call polyglot#detect#Inp()
2663+
au! BufNewFile,BufRead,BufWritePost *.inp call polyglot#detect#Inp()
26642664
endif
26652665

26662666
if !has_key(g:polyglot_is_disabled, 'abap')

scripts/build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -671,7 +671,7 @@ def generate_ftdetect(packages, heuristics)
671671

672672
for heuristic in filetype_heuristics.uniq
673673
extensions = heuristic["extensions"].map { |e| "*.#{e}" }
674-
autocommands << "au BufNewFile,BufRead,BufWritePost #{extensions.join(",")} call polyglot#detect##{camelize(heuristic["extensions"].first)}()"
674+
autocommands << "au! BufNewFile,BufRead,BufWritePost #{extensions.join(",")} call polyglot#detect##{camelize(heuristic["extensions"].first)}()"
675675
end
676676

677677
if autocommands.size > 0 && filetype["description"]

0 commit comments

Comments
 (0)