mirror of
https://github.com/sheerun/vim-polyglot.git
synced 2025-11-08 11:33:52 -05:00
Start github-linguist rewrite
This commit is contained in:
2
build
2
build
@@ -291,6 +291,8 @@ PACKS="
|
|||||||
zinit:zinit-zsh/zplugin-vim-syntax
|
zinit:zinit-zsh/zplugin-vim-syntax
|
||||||
"
|
"
|
||||||
|
|
||||||
|
python3 build.py
|
||||||
|
|
||||||
rm -rf tmp
|
rm -rf tmp
|
||||||
rm -rf "${DIRS_RM[@]}"
|
rm -rf "${DIRS_RM[@]}"
|
||||||
mkdir tmp
|
mkdir tmp
|
||||||
|
|||||||
43
build.py
Executable file
43
build.py
Executable file
@@ -0,0 +1,43 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
import yaml
|
||||||
|
import urllib.request as request
|
||||||
|
|
||||||
|
url = 'https://raw.githubusercontent.com/github/linguist/master/lib/linguist/languages.yml'
|
||||||
|
data = yaml.safe_load(request.urlopen(url))
|
||||||
|
|
||||||
|
lines = []
|
||||||
|
|
||||||
|
def language(name,
|
||||||
|
filetype=None,
|
||||||
|
polyglot=None,
|
||||||
|
extensions=None,
|
||||||
|
filenames=None,
|
||||||
|
extra_extensions=[],
|
||||||
|
extra_filenames=[]
|
||||||
|
):
|
||||||
|
language = data.get(name, {})
|
||||||
|
filetype_name = filetype or name.lower().replace(" ", "")
|
||||||
|
polyglot_name = polyglot or filetype_name
|
||||||
|
lines.append(f"if index(g:polyglot_disabled, '{polyglot_name}') == -1")
|
||||||
|
for ext in (extensions or language.get("extensions", [])) + extra_extensions:
|
||||||
|
lines.append(f" au BufNewFile,BufRead *{ext} set ft={filetype_name}")
|
||||||
|
for fn in (filenames or language.get("filenames", [])) + extra_filenames:
|
||||||
|
lines.append(f" au BufNewFile,BufRead {fn} set ft={filetype_name}")
|
||||||
|
lines.append("endif")
|
||||||
|
lines.append("")
|
||||||
|
|
||||||
|
language("ASL", polyglot="acpiasl", extensions=[".asl", ".dsl"])
|
||||||
|
language("API Blueprint")
|
||||||
|
language("AppleScript")
|
||||||
|
language("Processing", filetype="arduino", extra_extensions=[".ino"])
|
||||||
|
language("AsciiDoc")
|
||||||
|
language("Blade")
|
||||||
|
language("Caddyfile", extensions=["Caddyfile"])
|
||||||
|
language("Carp", extensions=[".carp"])
|
||||||
|
language("CoffeeScript", filetype="coffee")
|
||||||
|
language("Clojure")
|
||||||
|
|
||||||
|
f = open("ftdetect/polyglot_auto.vim", "w")
|
||||||
|
f.write("\n".join(lines))
|
||||||
|
f.close()
|
||||||
@@ -46,48 +46,6 @@ call s:SetDefault('g:python_highlight_operators', 1)
|
|||||||
call s:SetDefault('g:python_highlight_file_headers_as_comments', 1)
|
call s:SetDefault('g:python_highlight_file_headers_as_comments', 1)
|
||||||
call s:SetDefault('g:python_slow_sync', 1)
|
call s:SetDefault('g:python_slow_sync', 1)
|
||||||
|
|
||||||
if index(g:polyglot_disabled, 'acpiasl') == -1
|
|
||||||
au BufNewFile,BufRead *.asl set ft=asl
|
|
||||||
au BufNewFile,BufRead *.dsl set ft=asl
|
|
||||||
endif
|
|
||||||
|
|
||||||
if index(g:polyglot_disabled, 'apiblueprint') == -1
|
|
||||||
au BufNewFile,BufRead *.apib set ft=apiblueprint
|
|
||||||
endif
|
|
||||||
|
|
||||||
if index(g:polyglot_disabled, 'applescript') == -1
|
|
||||||
au BufNewFile,BufRead *.scpt set ft=applescript
|
|
||||||
au BufNewFile,BufRead *.applescript set ft=applescript
|
|
||||||
endif
|
|
||||||
|
|
||||||
if index(g:polyglot_disabled, 'arduino') == -1
|
|
||||||
au BufNewFile,BufRead *.ino,*.pde set ft=arduino
|
|
||||||
endif
|
|
||||||
|
|
||||||
if index(g:polyglot_disabled, 'asciidoc') == -1
|
|
||||||
au BufNewFile,BufRead *.asciidoc,*.adoc set ft=asciidoc
|
|
||||||
endif
|
|
||||||
|
|
||||||
if index(g:polyglot_disabled, 'blade') == -1
|
|
||||||
au BufNewFile,BufRead *.blade.php set ft=blade
|
|
||||||
endif
|
|
||||||
|
|
||||||
if index(g:polyglot_disabled, 'brewfile') == -1
|
|
||||||
au BufNewFile,BufRead Brewfile,.Brewfile set ft=ruby syn=brewfile
|
|
||||||
endif
|
|
||||||
|
|
||||||
if index(g:polyglot_disabled, 'caddyfile') == -1
|
|
||||||
au BufNewFile,BufRead Caddyfile set ft=caddyfile
|
|
||||||
endif
|
|
||||||
|
|
||||||
if index(g:polyglot_disabled, 'carp') == -1
|
|
||||||
au BufNewFile,BufRead *.carp set ft=carp
|
|
||||||
endif
|
|
||||||
|
|
||||||
if index(g:polyglot_disabled, 'cjsx') == -1
|
|
||||||
au BufNewFile,BufRead *.csx,*.cjsx set ft=coffee
|
|
||||||
endif
|
|
||||||
|
|
||||||
if index(g:polyglot_disabled, 'clojure') == -1
|
if index(g:polyglot_disabled, 'clojure') == -1
|
||||||
au BufNewFile,BufRead *.clj,*.cljs,*.edn,*.cljx,*.cljc,{build,profile}.boot set ft=clojure
|
au BufNewFile,BufRead *.clj,*.cljs,*.edn,*.cljx,*.cljc,{build,profile}.boot set ft=clojure
|
||||||
endif
|
endif
|
||||||
|
|||||||
59
ftdetect/polyglot_auto.vim
Normal file
59
ftdetect/polyglot_auto.vim
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
if index(g:polyglot_disabled, 'acpiasl') == -1
|
||||||
|
au BufNewFile,BufRead *.asl set ft=asl
|
||||||
|
au BufNewFile,BufRead *.dsl set ft=asl
|
||||||
|
endif
|
||||||
|
|
||||||
|
if index(g:polyglot_disabled, 'apiblueprint') == -1
|
||||||
|
au BufNewFile,BufRead *.apib set ft=apiblueprint
|
||||||
|
endif
|
||||||
|
|
||||||
|
if index(g:polyglot_disabled, 'applescript') == -1
|
||||||
|
au BufNewFile,BufRead *.applescript set ft=applescript
|
||||||
|
au BufNewFile,BufRead *.scpt set ft=applescript
|
||||||
|
endif
|
||||||
|
|
||||||
|
if index(g:polyglot_disabled, 'arduino') == -1
|
||||||
|
au BufNewFile,BufRead *.pde set ft=arduino
|
||||||
|
au BufNewFile,BufRead *.ino set ft=arduino
|
||||||
|
endif
|
||||||
|
|
||||||
|
if index(g:polyglot_disabled, 'asciidoc') == -1
|
||||||
|
au BufNewFile,BufRead *.asciidoc set ft=asciidoc
|
||||||
|
au BufNewFile,BufRead *.adoc set ft=asciidoc
|
||||||
|
au BufNewFile,BufRead *.asc set ft=asciidoc
|
||||||
|
endif
|
||||||
|
|
||||||
|
if index(g:polyglot_disabled, 'blade') == -1
|
||||||
|
au BufNewFile,BufRead *.blade set ft=blade
|
||||||
|
au BufNewFile,BufRead *.blade.php set ft=blade
|
||||||
|
endif
|
||||||
|
|
||||||
|
if index(g:polyglot_disabled, 'caddyfile') == -1
|
||||||
|
au BufNewFile,BufRead *Caddyfile set ft=caddyfile
|
||||||
|
endif
|
||||||
|
|
||||||
|
if index(g:polyglot_disabled, 'carp') == -1
|
||||||
|
au BufNewFile,BufRead *.carp set ft=carp
|
||||||
|
endif
|
||||||
|
|
||||||
|
if index(g:polyglot_disabled, 'coffee') == -1
|
||||||
|
au BufNewFile,BufRead *.coffee set ft=coffee
|
||||||
|
au BufNewFile,BufRead *._coffee set ft=coffee
|
||||||
|
au BufNewFile,BufRead *.cake set ft=coffee
|
||||||
|
au BufNewFile,BufRead *.cjsx set ft=coffee
|
||||||
|
au BufNewFile,BufRead *.iced set ft=coffee
|
||||||
|
au BufNewFile,BufRead Cakefile set ft=coffee
|
||||||
|
endif
|
||||||
|
|
||||||
|
if index(g:polyglot_disabled, 'clojure') == -1
|
||||||
|
au BufNewFile,BufRead *.clj set ft=clojure
|
||||||
|
au BufNewFile,BufRead *.boot set ft=clojure
|
||||||
|
au BufNewFile,BufRead *.cl2 set ft=clojure
|
||||||
|
au BufNewFile,BufRead *.cljc set ft=clojure
|
||||||
|
au BufNewFile,BufRead *.cljs set ft=clojure
|
||||||
|
au BufNewFile,BufRead *.cljs.hl set ft=clojure
|
||||||
|
au BufNewFile,BufRead *.cljscm set ft=clojure
|
||||||
|
au BufNewFile,BufRead *.cljx set ft=clojure
|
||||||
|
au BufNewFile,BufRead *.hic set ft=clojure
|
||||||
|
au BufNewFile,BufRead riemann.config set ft=clojure
|
||||||
|
endif
|
||||||
Reference in New Issue
Block a user