mirror of
https://github.com/sheerun/vim-polyglot.git
synced 2025-11-08 03:23:51 -05:00
De-duplicate runtime heuristic autocommands
This commit is contained in:
@@ -196,7 +196,7 @@ if !has_key(g:polyglot_is_disabled, 'xpm2')
|
||||
endif
|
||||
|
||||
if !has_key(g:polyglot_is_disabled, 'xpm')
|
||||
au BufNewFile,BufRead,BufWritePost *.pm call polyglot#detect#Pm()
|
||||
au! BufNewFile,BufRead,BufWritePost *.pm call polyglot#detect#Pm()
|
||||
au BufNewFile,BufRead *.xpm setf xpm
|
||||
endif
|
||||
|
||||
@@ -1323,7 +1323,7 @@ if !has_key(g:polyglot_is_disabled, 'tilde')
|
||||
endif
|
||||
|
||||
if !has_key(g:polyglot_is_disabled, 'html')
|
||||
au BufNewFile,BufRead,BufWritePost *.html call polyglot#detect#Html()
|
||||
au! BufNewFile,BufRead,BufWritePost *.html call polyglot#detect#Html()
|
||||
au BufNewFile,BufRead *.htm,*.html.hl,*.inc,*.xht,*.xhtml setf html
|
||||
endif
|
||||
|
||||
@@ -1785,11 +1785,11 @@ if !has_key(g:polyglot_is_disabled, 'gitignore')
|
||||
endif
|
||||
|
||||
if !has_key(g:polyglot_is_disabled, 'tads')
|
||||
au BufNewFile,BufRead,BufWritePost *.t call polyglot#detect#T()
|
||||
au! BufNewFile,BufRead,BufWritePost *.t call polyglot#detect#T()
|
||||
endif
|
||||
|
||||
if !has_key(g:polyglot_is_disabled, 'prolog')
|
||||
au BufNewFile,BufRead,BufWritePost *.pl call polyglot#detect#Pl()
|
||||
au! BufNewFile,BufRead,BufWritePost *.pl call polyglot#detect#Pl()
|
||||
au BufNewFile,BufRead *.pdb,*.pro,*.prolog,*.yap setf prolog
|
||||
endif
|
||||
|
||||
@@ -1812,7 +1812,7 @@ if !has_key(g:polyglot_is_disabled, 'spec')
|
||||
endif
|
||||
|
||||
if !has_key(g:polyglot_is_disabled, 'visual-basic')
|
||||
au BufNewFile,BufRead,BufWritePost *.bas call polyglot#detect#Bas()
|
||||
au! BufNewFile,BufRead,BufWritePost *.bas call polyglot#detect#Bas()
|
||||
au BufNewFile,BufRead *.cls,*.ctl,*.dsm,*.frm,*.frx,*.sba,*.vba,*.vbs setf vb
|
||||
endif
|
||||
|
||||
@@ -1821,7 +1821,7 @@ if !has_key(g:polyglot_is_disabled, 'basic')
|
||||
endif
|
||||
|
||||
if !has_key(g:polyglot_is_disabled, 'trasys')
|
||||
au BufNewFile,BufRead,BufWritePost *.inp call polyglot#detect#Inp()
|
||||
au! BufNewFile,BufRead,BufWritePost *.inp call polyglot#detect#Inp()
|
||||
endif
|
||||
|
||||
if !has_key(g:polyglot_is_disabled, 'zig')
|
||||
@@ -2013,7 +2013,7 @@ if !has_key(g:polyglot_is_disabled, 'rst')
|
||||
endif
|
||||
|
||||
if !has_key(g:polyglot_is_disabled, 'reason')
|
||||
au BufNewFile,BufRead,BufWritePost *.re call polyglot#detect#Re()
|
||||
au! BufNewFile,BufRead,BufWritePost *.re call polyglot#detect#Re()
|
||||
au BufNewFile,BufRead *.rei setf reason
|
||||
endif
|
||||
|
||||
@@ -2026,9 +2026,9 @@ if !has_key(g:polyglot_is_disabled, 'raml')
|
||||
endif
|
||||
|
||||
if !has_key(g:polyglot_is_disabled, 'raku')
|
||||
au BufNewFile,BufRead,BufWritePost *.t call polyglot#detect#T()
|
||||
au BufNewFile,BufRead,BufWritePost *.pm call polyglot#detect#Pm()
|
||||
au BufNewFile,BufRead,BufWritePost *.pl call polyglot#detect#Pl()
|
||||
au! BufNewFile,BufRead,BufWritePost *.t call polyglot#detect#T()
|
||||
au! BufNewFile,BufRead,BufWritePost *.pm call polyglot#detect#Pm()
|
||||
au! BufNewFile,BufRead,BufWritePost *.pl call polyglot#detect#Pl()
|
||||
au BufNewFile,BufRead *.6pl,*.6pm,*.nqp,*.p6,*.p6l,*.p6m,*.pl6,*.pm6,*.pod6,*.raku,*.rakudoc,*.rakumod,*.rakutest,*.t6 setf raku
|
||||
endif
|
||||
|
||||
@@ -2112,14 +2112,14 @@ if !has_key(g:polyglot_is_disabled, 'pgsql')
|
||||
endif
|
||||
|
||||
if !has_key(g:polyglot_is_disabled, 'perl')
|
||||
au BufNewFile,BufRead,BufWritePost *.t call polyglot#detect#T()
|
||||
au BufNewFile,BufRead,BufWritePost *.pm call polyglot#detect#Pm()
|
||||
au BufNewFile,BufRead,BufWritePost *.pl call polyglot#detect#Pl()
|
||||
au! BufNewFile,BufRead,BufWritePost *.t call polyglot#detect#T()
|
||||
au! BufNewFile,BufRead,BufWritePost *.pm call polyglot#detect#Pm()
|
||||
au! BufNewFile,BufRead,BufWritePost *.pl call polyglot#detect#Pl()
|
||||
au BufNewFile,BufRead *.al,*.cgi,*.fcgi,*.perl,*.ph,*.plx,*.psgi,{.,}gitolite.rc,Makefile.PL,Rexfile,ack,cpanfile,example.gitolite.rc setf perl
|
||||
au BufNewFile,BufRead *.pod setf pod
|
||||
au BufNewFile,BufRead *.comp,*.mason,*.mhtml setf mason
|
||||
au BufNewFile,BufRead,BufWritePost *.tt2 call polyglot#detect#Tt2()
|
||||
au BufNewFile,BufRead,BufWritePost *.tt2 call polyglot#detect#Tt2()
|
||||
au! BufNewFile,BufRead,BufWritePost *.tt2 call polyglot#detect#Tt2()
|
||||
au! BufNewFile,BufRead,BufWritePost *.tt2 call polyglot#detect#Tt2()
|
||||
au BufNewFile,BufRead *.xs setf xs
|
||||
endif
|
||||
|
||||
@@ -2132,7 +2132,7 @@ if !has_key(g:polyglot_is_disabled, 'opencl')
|
||||
endif
|
||||
|
||||
if !has_key(g:polyglot_is_disabled, 'octave')
|
||||
au BufNewFile,BufRead,BufWritePost *.m call polyglot#detect#M()
|
||||
au! BufNewFile,BufRead,BufWritePost *.m call polyglot#detect#M()
|
||||
au BufNewFile,BufRead *.oct setf octave
|
||||
endif
|
||||
|
||||
@@ -2149,8 +2149,8 @@ if !has_key(g:polyglot_is_disabled, 'ocaml')
|
||||
endif
|
||||
|
||||
if !has_key(g:polyglot_is_disabled, 'objc')
|
||||
au BufNewFile,BufRead,BufWritePost *.m call polyglot#detect#M()
|
||||
au BufNewFile,BufRead,BufWritePost *.h call polyglot#detect#H()
|
||||
au! BufNewFile,BufRead,BufWritePost *.m call polyglot#detect#M()
|
||||
au! BufNewFile,BufRead,BufWritePost *.h call polyglot#detect#H()
|
||||
endif
|
||||
|
||||
if !has_key(g:polyglot_is_disabled, 'nix')
|
||||
@@ -2168,7 +2168,7 @@ if !has_key(g:polyglot_is_disabled, 'nginx')
|
||||
endif
|
||||
|
||||
if !has_key(g:polyglot_is_disabled, 'murphi')
|
||||
au BufNewFile,BufRead,BufWritePost *.m call polyglot#detect#M()
|
||||
au! BufNewFile,BufRead,BufWritePost *.m call polyglot#detect#M()
|
||||
endif
|
||||
|
||||
if !has_key(g:polyglot_is_disabled, 'moonscript')
|
||||
@@ -2185,7 +2185,7 @@ if !has_key(g:polyglot_is_disabled, 'mdx')
|
||||
endif
|
||||
|
||||
if !has_key(g:polyglot_is_disabled, 'mathematica')
|
||||
au BufNewFile,BufRead,BufWritePost *.m call polyglot#detect#M()
|
||||
au! BufNewFile,BufRead,BufWritePost *.m call polyglot#detect#M()
|
||||
au BufNewFile,BufRead *.cdf,*.ma,*.mathematica,*.mma,*.mt,*.nb,*.nbp,*.wl,*.wls,*.wlt setf mma
|
||||
endif
|
||||
|
||||
@@ -2273,14 +2273,14 @@ if !has_key(g:polyglot_is_disabled, 'ion')
|
||||
endif
|
||||
|
||||
if !has_key(g:polyglot_is_disabled, 'idris2')
|
||||
au BufNewFile,BufRead,BufWritePost *.idr call polyglot#detect#Idr()
|
||||
au! BufNewFile,BufRead,BufWritePost *.idr call polyglot#detect#Idr()
|
||||
au BufNewFile,BufRead *.ipkg,idris-response setf idris2
|
||||
au BufNewFile,BufRead,BufWritePost *.lidr call polyglot#detect#Lidr()
|
||||
au! BufNewFile,BufRead,BufWritePost *.lidr call polyglot#detect#Lidr()
|
||||
endif
|
||||
|
||||
if !has_key(g:polyglot_is_disabled, 'idris')
|
||||
au BufNewFile,BufRead,BufWritePost *.lidr call polyglot#detect#Lidr()
|
||||
au BufNewFile,BufRead,BufWritePost *.idr call polyglot#detect#Idr()
|
||||
au! BufNewFile,BufRead,BufWritePost *.lidr call polyglot#detect#Lidr()
|
||||
au! BufNewFile,BufRead,BufWritePost *.idr call polyglot#detect#Idr()
|
||||
au BufNewFile,BufRead idris-response setf idris
|
||||
endif
|
||||
|
||||
@@ -2360,7 +2360,7 @@ if !has_key(g:polyglot_is_disabled, 'gmpl')
|
||||
endif
|
||||
|
||||
if !has_key(g:polyglot_is_disabled, 'glsl')
|
||||
au BufNewFile,BufRead,BufWritePost *.fs call polyglot#detect#Fs()
|
||||
au! BufNewFile,BufRead,BufWritePost *.fs call polyglot#detect#Fs()
|
||||
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
|
||||
endif
|
||||
|
||||
@@ -2377,12 +2377,12 @@ if !has_key(g:polyglot_is_disabled, 'gdscript')
|
||||
endif
|
||||
|
||||
if !has_key(g:polyglot_is_disabled, 'fsharp')
|
||||
au BufNewFile,BufRead,BufWritePost *.fs call polyglot#detect#Fs()
|
||||
au! BufNewFile,BufRead,BufWritePost *.fs call polyglot#detect#Fs()
|
||||
au BufNewFile,BufRead *.fsi,*.fsx setf fsharp
|
||||
endif
|
||||
|
||||
if !has_key(g:polyglot_is_disabled, 'forth')
|
||||
au BufNewFile,BufRead,BufWritePost *.fs call polyglot#detect#Fs()
|
||||
au! BufNewFile,BufRead,BufWritePost *.fs call polyglot#detect#Fs()
|
||||
au BufNewFile,BufRead *.ft,*.fth setf forth
|
||||
endif
|
||||
|
||||
@@ -2514,12 +2514,12 @@ if !has_key(g:polyglot_is_disabled, 'atlas')
|
||||
endif
|
||||
|
||||
if !has_key(g:polyglot_is_disabled, 'aspperl')
|
||||
au BufNewFile,BufRead,BufWritePost *.asp call polyglot#detect#Asp()
|
||||
au! BufNewFile,BufRead,BufWritePost *.asp call polyglot#detect#Asp()
|
||||
endif
|
||||
|
||||
if !has_key(g:polyglot_is_disabled, 'aspvbs')
|
||||
au BufNewFile,BufRead,BufWritePost *.asp call polyglot#detect#Asp()
|
||||
au BufNewFile,BufRead,BufWritePost *.asa call polyglot#detect#Asa()
|
||||
au! BufNewFile,BufRead,BufWritePost *.asp call polyglot#detect#Asp()
|
||||
au! BufNewFile,BufRead,BufWritePost *.asa call polyglot#detect#Asa()
|
||||
endif
|
||||
|
||||
if !has_key(g:polyglot_is_disabled, 'asn')
|
||||
@@ -2555,9 +2555,9 @@ if !has_key(g:polyglot_is_disabled, 'arduino')
|
||||
endif
|
||||
|
||||
if !has_key(g:polyglot_is_disabled, 'c/c++')
|
||||
au BufNewFile,BufRead,BufWritePost *.h call polyglot#detect#H()
|
||||
au! BufNewFile,BufRead,BufWritePost *.h call polyglot#detect#H()
|
||||
au BufNewFile,BufRead *.c++,*.cc,*.cp,*.cpp,*.cxx,*.h++,*.hh,*.hpp,*.hxx,*.inc,*.inl,*.ipp,*.moc,*.tcc,*.tlh,*.tpp setf cpp
|
||||
au BufNewFile,BufRead,BufWritePost *.h call polyglot#detect#H()
|
||||
au! BufNewFile,BufRead,BufWritePost *.h call polyglot#detect#H()
|
||||
au BufNewFile,BufRead *.c,*.cats,*.idc,*.qc,*enlightenment/*.cfg setf c
|
||||
endif
|
||||
|
||||
@@ -2660,7 +2660,7 @@ if !has_key(g:polyglot_is_disabled, 'abc')
|
||||
endif
|
||||
|
||||
if !has_key(g:polyglot_is_disabled, 'abaqus')
|
||||
au BufNewFile,BufRead,BufWritePost *.inp call polyglot#detect#Inp()
|
||||
au! BufNewFile,BufRead,BufWritePost *.inp call polyglot#detect#Inp()
|
||||
endif
|
||||
|
||||
if !has_key(g:polyglot_is_disabled, 'abap')
|
||||
|
||||
@@ -671,7 +671,7 @@ def generate_ftdetect(packages, heuristics)
|
||||
|
||||
for heuristic in filetype_heuristics.uniq
|
||||
extensions = heuristic["extensions"].map { |e| "*.#{e}" }
|
||||
autocommands << "au BufNewFile,BufRead,BufWritePost #{extensions.join(",")} call polyglot#detect##{camelize(heuristic["extensions"].first)}()"
|
||||
autocommands << "au! BufNewFile,BufRead,BufWritePost #{extensions.join(",")} call polyglot#detect##{camelize(heuristic["extensions"].first)}()"
|
||||
end
|
||||
|
||||
if autocommands.size > 0 && filetype["description"]
|
||||
|
||||
Reference in New Issue
Block a user