Compare commits

...

1 Commits

Author SHA1 Message Date
Adam Stankiewicz
1eed30b2af Fix filetype detection and docini filetypes 2020-09-10 14:07:02 +02:00
8 changed files with 292 additions and 67 deletions

View File

@@ -7,7 +7,7 @@ A collection of language packs for Vim.
> One to rule them all, one to find them, one to bring them all and in the darkness bind them. > One to rule them all, one to find them, one to bring them all and in the darkness bind them.
- It **won't affect your startup time**, as scripts are loaded only on demand\*. - It **won't affect your startup time**, as scripts are loaded only on demand\*.
- It **installs and updates 120+ times faster** than the <!--Package Count-->194<!--/Package Count--> packages it consists of. - It **installs and updates 120+ times faster** than the <!--Package Count-->195<!--/Package Count--> packages it consists of.
- It is more secure because scripts loaded for all extensions are generated by vim-polyglot (ftdetect). - It is more secure because scripts loaded for all extensions are generated by vim-polyglot (ftdetect).
- Solid syntax and indentation support (other features skipped). Only the best language packs. - Solid syntax and indentation support (other features skipped). Only the best language packs.
- All unnecessary files are ignored (like enormous documentation from php support). - All unnecessary files are ignored (like enormous documentation from php support).
@@ -98,6 +98,7 @@ If you need full functionality of any plugin, please use it directly with your p
- [dhall](https://github.com/vmchale/dhall-vim) - [dhall](https://github.com/vmchale/dhall-vim)
- [dlang](https://github.com/JesseKPhillips/d.vim) - [dlang](https://github.com/JesseKPhillips/d.vim)
- [dockerfile](https://github.com/ekalinin/Dockerfile.vim) - [dockerfile](https://github.com/ekalinin/Dockerfile.vim)
- [dosini](https://github.com/vim/vim/tree/master/runtime)
- [elf](https://github.com/vim/vim/tree/master/runtime) - [elf](https://github.com/vim/vim/tree/master/runtime)
- [elixir](https://github.com/elixir-lang/vim-elixir) - [elixir](https://github.com/elixir-lang/vim-elixir)
- [elm](https://github.com/andys8/vim-elm-syntax) - [elm](https://github.com/andys8/vim-elm-syntax)

View File

@@ -57,7 +57,7 @@ let s:globs = {
\ 'dd': '*.dd', \ 'dd': '*.dd',
\ 'ddoc': '*.ddoc', \ 'ddoc': '*.ddoc',
\ 'dhall': '*.dhall', \ 'dhall': '*.dhall',
\ 'dosini': '*.wrap', \ 'dosini': '*.wrap,*.ini,*.cfg,*.dof,*.lektorproject,*.prefs,*.pro,*.properties,buildozer.spec,php.ini-*',
\ 'dsdl': '*.sdl', \ 'dsdl': '*.sdl',
\ 'dune': 'jbuild,dune,dune-project,dune-workspace', \ 'dune': 'jbuild,dune,dune-project,dune-workspace',
\ 'ecrystal': '*.ecr', \ 'ecrystal': '*.ecr',
@@ -110,7 +110,7 @@ let s:globs = {
\ 'javascriptreact': '*.jsx', \ 'javascriptreact': '*.jsx',
\ 'jinja.html': '*.jinja,*.j2,*.jinja2', \ 'jinja.html': '*.jinja,*.j2,*.jinja2',
\ 'jq': '*.jq', \ 'jq': '*.jq',
\ 'json': '*.json,*.avsc,*.geojson,*.gltf,*.har,*.ice,*.JSON-tmLanguage,*.jsonl,*.mcmeta,*.tfstate,*.tfstate.backup,*.topojson,*.webapp,*.webmanifest,*.yy,*.yyp,*.jsonp,*.template,composer.lock,mcmod.info', \ 'json': '*.json,*.avsc,*.geojson,*.gltf,*.har,*.ice,*.JSON-tmLanguage,*.jsonl,*.mcmeta,*.tfstate,*.tfstate.backup,*.topojson,*.webapp,*.webmanifest,*.yy,*.yyp,*.jsonp,*.template,composer.lock,mcmod.info,Pipfile.lock',
\ 'json5': '*.json5', \ 'json5': '*.json5',
\ 'jsonnet': '*.jsonnet,*.libsonnet', \ 'jsonnet': '*.jsonnet,*.libsonnet',
\ 'jst': '*.ejs,*.ect,*.jst', \ 'jst': '*.ejs,*.ect,*.jst',
@@ -130,7 +130,7 @@ let s:globs = {
\ 'markdown': '*.md,*.markdown,*.mdown,*.mdwn,*.mkd,*.mkdn,*.mkdown,*.ronn,*.workbook,contents.lr', \ 'markdown': '*.md,*.markdown,*.mdown,*.mdwn,*.mkd,*.mkdn,*.mkdown,*.ronn,*.workbook,contents.lr',
\ 'markdown.mdx': '*.mdx', \ 'markdown.mdx': '*.mdx',
\ 'meson': 'meson.build,meson_options.txt', \ 'meson': 'meson.build,meson_options.txt',
\ 'mma': '*.mathematica,*.cdf,*.m,*.ma,*.mt,*.nb,*.nbp,*.wl,*.wlt,*.wls', \ 'mma': '*.mathematica,*.cdf,*.m,*.ma,*.mt,*.nb,*.nbp,*.wl,*.wlt,*.wls,*.mma',
\ 'moon': '*.moon', \ 'moon': '*.moon',
\ 'murphi': '*.m', \ 'murphi': '*.m',
\ 'mustache': '*.handlebars,*.hbs,*.hulk,*.hjs,*.mustache,*.njk,*.hogan,*.hdbs,*.hb', \ 'mustache': '*.handlebars,*.hbs,*.hulk,*.hjs,*.mustache,*.njk,*.hogan,*.hdbs,*.hb',

View File

@@ -73,6 +73,8 @@ func! s:StarSetf(ft)
endif endif
endfunc endfunc
augroup filetypedetect
" filetypes " filetypes
if !has_key(s:disabled_packages, '8th') if !has_key(s:disabled_packages, '8th')
@@ -95,12 +97,24 @@ if !has_key(s:disabled_packages, 'abc')
au! BufRead,BufNewFile *.abc au! BufRead,BufNewFile *.abc
endif endif
if !has_key(s:disabled_packages, 'abel')
au! BufRead,BufNewFile *.abl
endif
if !has_key(s:disabled_packages, 'acedb')
au! BufRead,BufNewFile *.wrm
endif
if !has_key(s:disabled_packages, 'acpiasl') if !has_key(s:disabled_packages, 'acpiasl')
au! BufRead,BufNewFile *.dsl au! BufRead,BufNewFile *.dsl
endif endif
if !has_key(s:disabled_packages, 'ada') if !has_key(s:disabled_packages, 'ada')
au! BufRead,BufNewFile *.ada au! BufRead,BufNewFile *.adb,*.ads,*.ada,*.adc,*.gpr,*.ada_m
endif
if !has_key(s:disabled_packages, 'ahdl')
au! BufRead,BufNewFile *.tdf
endif endif
if !has_key(s:disabled_packages, 'aidl') if !has_key(s:disabled_packages, 'aidl')
@@ -111,8 +125,16 @@ if !has_key(s:disabled_packages, 'aml')
au! BufRead,BufNewFile *.aml au! BufRead,BufNewFile *.aml
endif endif
if !has_key(s:disabled_packages, 'ampl')
au! BufRead,BufNewFile *.run
endif
if !has_key(s:disabled_packages, 'applescript') if !has_key(s:disabled_packages, 'applescript')
au! BufRead,BufNewFile *.applescript au! BufRead,BufNewFile *.scpt
endif
if !has_key(s:disabled_packages, 'arduino')
au! BufRead,BufNewFile *.pde,*.ino
endif endif
if !has_key(s:disabled_packages, 'art') if !has_key(s:disabled_packages, 'art')
@@ -120,11 +142,23 @@ if !has_key(s:disabled_packages, 'art')
endif endif
if !has_key(s:disabled_packages, 'asciidoc') if !has_key(s:disabled_packages, 'asciidoc')
au! BufRead,BufNewFile *.asciidoc au! BufRead,BufNewFile *.asciidoc,*.adoc
endif
if !has_key(s:disabled_packages, 'autohotkey')
au! BufRead,BufNewFile *.ahk
endif endif
if !has_key(s:disabled_packages, 'asn') if !has_key(s:disabled_packages, 'asn')
au! BufRead,BufNewFile *.asn au! BufRead,BufNewFile *.asn,*.asn1
endif
if !has_key(s:disabled_packages, 'atlas')
au! BufRead,BufNewFile *.atl,*.as
endif
if !has_key(s:disabled_packages, 'autoit')
au! BufRead,BufNewFile *.au3
endif endif
if !has_key(s:disabled_packages, 'ave') if !has_key(s:disabled_packages, 'ave')
@@ -132,19 +166,27 @@ if !has_key(s:disabled_packages, 'ave')
endif endif
if !has_key(s:disabled_packages, 'awk') if !has_key(s:disabled_packages, 'awk')
au! BufRead,BufNewFile *.awk au! BufRead,BufNewFile *.awk,*.gawk
endif endif
if !has_key(s:disabled_packages, 'c/c++') if !has_key(s:disabled_packages, 'c/c++')
au! BufRead,BufNewFile *.cpp,*.tpp,*.c au! BufRead,BufNewFile *.cpp,*.c++,*.cc,*.cxx,*.hh,*.hpp,*.hxx,*.inl,*.ipp,*.tcc,*.tpp,*.moc,*.tlh,*.qc
endif
if !has_key(s:disabled_packages, 'clojure')
au! BufRead,BufNewFile *.clj,*.cljc,*.cljs,*.cljx
endif endif
if !has_key(s:disabled_packages, 'cmake') if !has_key(s:disabled_packages, 'cmake')
au! BufRead,BufNewFile *.cmake au! BufRead,BufNewFile *.cmake,*.cmake.in
endif
if !has_key(s:disabled_packages, 'cucumber')
au! BufRead,BufNewFile *.feature
endif endif
if !has_key(s:disabled_packages, 'dart') if !has_key(s:disabled_packages, 'dart')
au! BufRead,BufNewFile *.dart au! BufRead,BufNewFile *.dart,*.drt
endif endif
if !has_key(s:disabled_packages, 'dlang') if !has_key(s:disabled_packages, 'dlang')
@@ -152,27 +194,43 @@ if !has_key(s:disabled_packages, 'dlang')
endif endif
if !has_key(s:disabled_packages, 'dockerfile') if !has_key(s:disabled_packages, 'dockerfile')
au! BufRead,BufNewFile *.dockerfile au! BufRead,BufNewFile *.Dockerfile
endif
if !has_key(s:disabled_packages, 'elf')
au! BufRead,BufNewFile *.am
endif endif
if !has_key(s:disabled_packages, 'elm') if !has_key(s:disabled_packages, 'elm')
au! BufRead,BufNewFile *.elm au! BufRead,BufNewFile *.elm
endif endif
if !has_key(s:disabled_packages, 'git') if !has_key(s:disabled_packages, 'erlang')
au! BufRead,BufNewFile *.gitconfig au! BufRead,BufNewFile *.erl,*.es,*.hrl,*.yaws
endif
if !has_key(s:disabled_packages, 'forth')
au! BufRead,BufNewFile *.fs,*.ft,*.fth
endif
if !has_key(s:disabled_packages, 'fsharp')
au! BufRead,BufNewFile *.fs
endif
if !has_key(s:disabled_packages, 'glsl')
au! BufRead,BufNewFile *.fs,*.gs,*.comp
endif endif
if !has_key(s:disabled_packages, 'gnuplot') if !has_key(s:disabled_packages, 'gnuplot')
au! BufRead,BufNewFile *.gp,*.gnuplot au! BufRead,BufNewFile *.gp,*.gpi
endif endif
if !has_key(s:disabled_packages, 'go') if !has_key(s:disabled_packages, 'go')
au! BufRead,BufNewFile *.go au! BufRead,BufNewFile *.go,*.tmpl
endif endif
if !has_key(s:disabled_packages, 'groovy') if !has_key(s:disabled_packages, 'groovy')
au! BufRead,BufNewFile *.groovy au! BufRead,BufNewFile *.groovy,*.gradle
endif endif
if !has_key(s:disabled_packages, 'haml') if !has_key(s:disabled_packages, 'haml')
@@ -187,28 +245,56 @@ if !has_key(s:disabled_packages, 'haproxy')
au! BufRead,BufNewFile *.cfg au! BufRead,BufNewFile *.cfg
endif endif
if !has_key(s:disabled_packages, 'haskell')
au! BufRead,BufNewFile *.hs,*.hs-boot,*.hsc
endif
if !has_key(s:disabled_packages, 'html5') if !has_key(s:disabled_packages, 'html5')
au! BufRead,BufNewFile *.st,*.xhtml au! BufRead,BufNewFile *.st,*.xht,*.xhtml
endif
if !has_key(s:disabled_packages, 'jsx')
au! BufRead,BufNewFile *.jsx
endif
if !has_key(s:disabled_packages, 'javascript')
au! BufRead,BufNewFile *.js,*.cjs,*.es,*.gs,*.mjs,*.pac
endif endif
if !has_key(s:disabled_packages, 'json') if !has_key(s:disabled_packages, 'json')
au! BufRead,BufNewFile *.json,*.template au! BufRead,BufNewFile *.json,*.ice,*.webmanifest,*.yy,*.jsonp
endif
if !has_key(s:disabled_packages, 'kotlin')
au! BufRead,BufNewFile *.kt,*.ktm,*.kts
endif endif
if !has_key(s:disabled_packages, 'less') if !has_key(s:disabled_packages, 'less')
au! BufRead,BufNewFile *.less au! BufRead,BufNewFile *.less
endif endif
if !has_key(s:disabled_packages, 'llvm')
au! BufRead,BufNewFile *.ll
endif
if !has_key(s:disabled_packages, 'lua') if !has_key(s:disabled_packages, 'lua')
au! BufRead,BufNewFile *.lua au! BufRead,BufNewFile *.lua,*.nse,*.rockspec
endif endif
if !has_key(s:disabled_packages, 'm4') if !has_key(s:disabled_packages, 'm4')
au! BufRead,BufNewFile *.m4 au! BufRead,BufNewFile *.m4,*.at
endif
if !has_key(s:disabled_packages, 'mathematica')
au! BufRead,BufNewFile *.cdf,*.nb
endif endif
if !has_key(s:disabled_packages, 'markdown') if !has_key(s:disabled_packages, 'markdown')
au! BufRead,BufNewFile *.markdown au! BufRead,BufNewFile *.md,*.markdown,*.mdown,*.mdwn,*.mkd,*.mkdn
endif
if !has_key(s:disabled_packages, 'ocaml')
au! BufRead,BufNewFile *.ml,*.mli,*.mll,*.mly
endif endif
if !has_key(s:disabled_packages, 'opencl') if !has_key(s:disabled_packages, 'opencl')
@@ -216,11 +302,11 @@ if !has_key(s:disabled_packages, 'opencl')
endif endif
if !has_key(s:disabled_packages, 'perl') if !has_key(s:disabled_packages, 'perl')
au! BufRead,BufNewFile *.perl au! BufRead,BufNewFile *.al,*.plx,*.psgi,*.t
endif endif
if !has_key(s:disabled_packages, 'php') if !has_key(s:disabled_packages, 'php')
au! BufRead,BufNewFile *.php au! BufRead,BufNewFile *.php,*.ctp
endif endif
if !has_key(s:disabled_packages, 'protobuf') if !has_key(s:disabled_packages, 'protobuf')
@@ -228,15 +314,19 @@ if !has_key(s:disabled_packages, 'protobuf')
endif endif
if !has_key(s:disabled_packages, 'python') if !has_key(s:disabled_packages, 'python')
au! BufRead,BufNewFile *.spec au! BufRead,BufNewFile *.py,*.pyi,*.pyw,*.spec
endif endif
if !has_key(s:disabled_packages, 'r-lang') if !has_key(s:disabled_packages, 'r-lang')
au! BufRead,BufNewFile *.r au! BufRead,BufNewFile *.s,*.S,*.rd
endif
if !has_key(s:disabled_packages, 'racket')
au! BufRead,BufNewFile *.rkt
endif endif
if !has_key(s:disabled_packages, 'raku') if !has_key(s:disabled_packages, 'raku')
au! BufRead,BufNewFile *.pod6 au! BufRead,BufNewFile *.p6,*.pl6,*.pm6,*.t,*.raku,*.rakumod,*.pod6
endif endif
if !has_key(s:disabled_packages, 'raml') if !has_key(s:disabled_packages, 'raml')
@@ -248,7 +338,11 @@ if !has_key(s:disabled_packages, 'rst')
endif endif
if !has_key(s:disabled_packages, 'ruby') if !has_key(s:disabled_packages, 'ruby')
au! BufRead,BufNewFile *.ruby,*.spec au! BufRead,BufNewFile *.rb,*.builder,*.gemspec,*.rake,*.rbw,*.ru,*.spec,*.rxml,*.rjs,*.rant,*.erb,*.rhtml
endif
if !has_key(s:disabled_packages, 'rust')
au! BufRead,BufNewFile *.rs
endif endif
if !has_key(s:disabled_packages, 'scala') if !has_key(s:disabled_packages, 'scala')
@@ -264,7 +358,11 @@ if !has_key(s:disabled_packages, 'scss')
endif endif
if !has_key(s:disabled_packages, 'sh') if !has_key(s:disabled_packages, 'sh')
au! BufRead,BufNewFile *.sh,*.tmux,*.zsh au! BufRead,BufNewFile *.zsh
endif
if !has_key(s:disabled_packages, 'smt2')
au! BufRead,BufNewFile *.smt
endif endif
if !has_key(s:disabled_packages, 'svg') if !has_key(s:disabled_packages, 'svg')
@@ -283,24 +381,44 @@ if !has_key(s:disabled_packages, 'twig')
au! BufRead,BufNewFile *.twig au! BufRead,BufNewFile *.twig
endif endif
if !has_key(s:disabled_packages, 'typescript')
au! BufRead,BufNewFile *.ts,*.tsx
endif
if !has_key(s:disabled_packages, 'v')
au! BufRead,BufNewFile *.v
endif
if !has_key(s:disabled_packages, 'vbnet') if !has_key(s:disabled_packages, 'vbnet')
au! BufRead,BufNewFile *.vb au! BufRead,BufNewFile *.vb
endif endif
if !has_key(s:disabled_packages, 'vmasm')
au! BufRead,BufNewFile *.mar
endif
if !has_key(s:disabled_packages, 'vue') if !has_key(s:disabled_packages, 'vue')
au! BufRead,BufNewFile *.vue au! BufRead,BufNewFile *.vue
endif endif
if !has_key(s:disabled_packages, 'xml') if !has_key(s:disabled_packages, 'xml')
au! BufRead,BufNewFile *.xml,*.ant,*.xsd au! BufRead,BufNewFile *.csproj,*.ui,*.wsdl,*.wsf,*.xlf,*.xliff,*.xmi,*.xsd,*.xul
endif endif
if !has_key(s:disabled_packages, 'xsl') if !has_key(s:disabled_packages, 'xsl')
au! BufRead,BufNewFile *.xslt au! BufRead,BufNewFile *.xslt,*.xsl
endif endif
if !has_key(s:disabled_packages, 'yaml') if !has_key(s:disabled_packages, 'yaml')
au! BufRead,BufNewFile *.yaml au! BufRead,BufNewFile *.yml,*.yaml
endif
if !has_key(s:disabled_packages, 'visual-basic')
au! BufRead,BufNewFile *.vba,*.vbs,*.dsm,*.ctl,*.sba
endif
if !has_key(s:disabled_packages, 'dosini')
au! BufRead,BufNewFile *.ini,*.cfg,*.properties
endif endif
if !has_key(s:disabled_packages, '8th') if !has_key(s:disabled_packages, '8th')
@@ -928,6 +1046,7 @@ if !has_key(s:disabled_packages, 'json')
au BufNewFile,BufRead {.,}tern-config setf json au BufNewFile,BufRead {.,}tern-config setf json
au BufNewFile,BufRead {.,}tern-project setf json au BufNewFile,BufRead {.,}tern-project setf json
au BufNewFile,BufRead {.,}watchmanconfig setf json au BufNewFile,BufRead {.,}watchmanconfig setf json
au BufNewFile,BufRead Pipfile.lock setf json
au BufNewFile,BufRead composer.lock setf json au BufNewFile,BufRead composer.lock setf json
au BufNewFile,BufRead mcmod.info setf json au BufNewFile,BufRead mcmod.info setf json
endif endif
@@ -1021,6 +1140,7 @@ if !has_key(s:disabled_packages, 'mathematica')
au BufNewFile,BufRead *.cdf setf mma au BufNewFile,BufRead *.cdf setf mma
au BufNewFile,BufRead *.ma setf mma au BufNewFile,BufRead *.ma setf mma
au BufNewFile,BufRead *.mathematica setf mma au BufNewFile,BufRead *.mathematica setf mma
au BufNewFile,BufRead *.mma setf mma
au BufNewFile,BufRead *.mt setf mma au BufNewFile,BufRead *.mt setf mma
au BufNewFile,BufRead *.nb setf mma au BufNewFile,BufRead *.nb setf mma
au BufNewFile,BufRead *.nbp setf mma au BufNewFile,BufRead *.nbp setf mma
@@ -1771,9 +1891,28 @@ if !has_key(s:disabled_packages, 'visual-basic')
au! BufNewFile,BufRead *.bas call polyglot#DetectBasFiletype() au! BufNewFile,BufRead *.bas call polyglot#DetectBasFiletype()
endif endif
if !has_key(s:disabled_packages, 'dosini')
au BufNewFile,BufRead *.cfg setf dosini
au BufNewFile,BufRead *.dof setf dosini
au BufNewFile,BufRead *.ini setf dosini
au BufNewFile,BufRead *.lektorproject setf dosini
au BufNewFile,BufRead *.prefs setf dosini
au BufNewFile,BufRead *.pro setf dosini
au BufNewFile,BufRead *.properties setf dosini
au BufNewFile,BufRead */etc/pacman.conf setf dosini
au BufNewFile,BufRead */etc/yum.conf setf dosini
au BufNewFile,BufRead */etc/yum.repos.d/* call s:StarSetf('dosini')
au BufNewFile,BufRead {.,}editorconfig setf dosini
au BufNewFile,BufRead {.,}npmrc setf dosini
au BufNewFile,BufRead buildozer.spec setf dosini
au BufNewFile,BufRead php.ini-* call s:StarSetf('dosini')
endif
" end filetypes " end filetypes
augroup END
au BufNewFile,BufRead,StdinReadPost * au BufNewFile,BufRead,StdinReadPost *
\ if !did_filetype() && expand("<afile>") !~ g:ft_ignore_pat \ if !did_filetype() && expand("<afile>") !~ g:ft_ignore_pat
\ | call polyglot#Heuristics() | endif \ | call polyglot#Heuristics() | endif

23
ftplugin/dosini.vim Normal file
View File

@@ -0,0 +1,23 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'dosini') == -1
" Vim filetype plugin file
" Language: Configuration File (ini file) for MSDOS/MS Windows
" Previous Maintainer: Nikolai Weibull <now@bitwi.se>
" Latest Revision: 2008-07-09
if exists("b:did_ftplugin")
finish
endif
let b:did_ftplugin = 1
let s:cpo_save = &cpo
set cpo&vim
let b:undo_ftplugin = "setl com< cms< fo<"
setlocal comments=:; commentstring=;\ %s formatoptions-=t formatoptions+=croql
let &cpo = s:cpo_save
unlet s:cpo_save
endif

View File

@@ -904,6 +904,8 @@ filetypes:
extra_extensions: extra_extensions:
- jsonp - jsonp
- template - template
extra_filenames:
- Pipfile.lock
--- ---
name: jsonnet name: jsonnet
remote: google/vim-jsonnet remote: google/vim-jsonnet
@@ -1025,6 +1027,7 @@ filetypes:
linguist: Mathematica linguist: Mathematica
extra_extensions: extra_extensions:
- wls - wls
- mma
--- ---
name: markdown name: markdown
remote: plasticboy/vim-markdown remote: plasticboy/vim-markdown
@@ -1808,3 +1811,19 @@ filetypes:
- sba - sba
ignored_warnings: ignored_warnings:
- vb - vb
---
name: dosini
remote: vim/vim:runtime
glob: '**/dosini.vim'
filetypes:
- name: dosini
linguist: INI
extra_filenames:
- .editorconfig
- .npmrc
- '*/etc/pacman.conf'
- 'php.ini-*'
- '*/etc/yum.conf'
- '*/etc/yum.repos.d/*'
ignored_warnings:
- php.ini

View File

@@ -36,7 +36,6 @@ def load_data()
end end
end end
puts deps["javascript"]
each_node = lambda {|&b| packages.keys.each(&b) } each_node = lambda {|&b| packages.keys.each(&b) }
each_child = lambda {|n, &b| deps[n].each(&b) } each_child = lambda {|n, &b| deps[n].each(&b) }
@@ -433,21 +432,15 @@ def generate_ftdetect(packages, heuristics)
ambiguous_extensions = extensions ambiguous_extensions = extensions
.select { |a, b| b.uniq.size > 1 }.keys.sort .select { |a, b| b.uniq.size > 1 }.keys.sort
expected_filetypes = detect_filetypes('tmp/**/ftdetect/*.vim') all_filetypes = packages.flat_map { |f| f["filetypes"] || [] }
filetype_names = Set.new(all_filetypes.map { |f| f["name"] })
native_filetypes = detect_filetypes('tmp/vim/vim/runtime/filetype.vim') native_filetypes = detect_filetypes('tmp/vim/vim/runtime/filetype.vim')
native_extensions = native_filetypes.flat_map { |k, v| v["extensions"] } expected_filetypes = detect_filetypes('tmp/**/ftdetect/*.vim') + native_filetypes
all_filetypes = Hash.new { |h, k| h[k] = { extensions: [], filenames: [] } } expected_filetypes = expected_filetypes.select { |e| filetype_names.include?(e["name"]) }
for k, v in expected_filetypes native_extensions = Set.new(native_filetypes.flat_map { |f| f["extensions"] || [] })
all_filetypes[k][:extensions].concat(v[:extensions])
all_filetypes[k][:filenames].concat(v[:filenames])
end
for k, v in native_filetypes
all_filetypes[k][:extensions].concat(v[:extensions])
all_filetypes[k][:filenames].concat(v[:filenames])
end
for package in packages for package in packages
name = package.fetch("name") name = package.fetch("name")
@@ -456,7 +449,7 @@ def generate_ftdetect(packages, heuristics)
for filetype in package["filetypes"] for filetype in package["filetypes"]
for extension in filetype["extensions"] for extension in filetype["extensions"]
if native_filetypes.has_key?(extension) if native_extensions.include?(extension)
to_disable << "*." + extension to_disable << "*." + extension
end end
end end
@@ -492,20 +485,6 @@ def generate_ftdetect(packages, heuristics)
extensions = filetype["extensions"] extensions = filetype["extensions"]
filenames = filetype["filenames"] filenames = filetype["filenames"]
expected_extensions = (all_filetypes.has_key?(name) ? all_filetypes.fetch(name)[:extensions] : [])
ignored_extensions = expand_all(filetype.fetch("ignored_extensions", []))
ignored_warnings = expand_all(filetype.fetch("ignored_warnings", []))
if all_filetypes[name] && !filetype["syntax"]
for e in expected_extensions - extensions - ignored_extensions - ignored_warnings
puts "Probable missing extension for #{name}: #{e}"
end
for e in all_filetypes.fetch(name)[:filenames] - expand_all(filenames).flat_map { |e| [e, e.gsub(/^\./, '')] } - expand_all(filetype.fetch("ignored_warnings", [])) - ['*']
puts "Probable missing filename for #{name}: #{e}"
end
end
for extension in extensions.sort for extension in extensions.sort
outer_filetype = filetype["outer_filetype"] outer_filetype = filetype["outer_filetype"]
if outer_filetype if outer_filetype
@@ -549,6 +528,24 @@ def generate_ftdetect(packages, heuristics)
end end
end end
defined_extensions = all_filetypes.flat_map { |f| expand_all(f["extensions"] || []).map { |e| [f["name"], e] } }
expected_extensions = expected_filetypes.flat_map { |f| expand_all(f["extensions"] || []).map { |e| [f["name"], e] } }
ignored_extensions = all_filetypes.flat_map { |f| expand_all(f.fetch("ignored_extensions", [])).map { |e| [f["name"], e] } }
defined_filenames = all_filetypes.flat_map { |f| expand_all(f["filenames"] || []).map { |e| [f["name"], e] } }
expected_filenames = expected_filetypes.flat_map { |f| expand_all(f["filenames"] || []).map { |e| [f["name"], e] } }
ignored_filenames = all_filetypes.flat_map { |f| expand_all(f.fetch("ignored_filenames", [])).map { |e| [f["name"], e] } }
ignored_warnings = all_filetypes.flat_map { |f| expand_all(f.fetch("ignored_warnings", [])).map { |e| [f["name"], e] } + [f, "*"] }
for name, e in expected_extensions - defined_extensions - ignored_extensions - ignored_warnings
puts "Missing extension for #{name}: #{e}"
end
for name, e in expected_filenames - defined_filenames - ignored_filenames - ignored_warnings
puts "Missing filename for #{name}: #{e}"
end
ftdetect = File.read('ftdetect/polyglot.vim') ftdetect = File.read('ftdetect/polyglot.vim')
File.write('ftdetect/polyglot.vim', ftdetect.gsub(/(?<=" filetypes\n).*(?=\n" end filetypes)/m, output)) File.write('ftdetect/polyglot.vim', ftdetect.gsub(/(?<=" filetypes\n).*(?=\n" end filetypes)/m, output))
@@ -728,14 +725,15 @@ def detect_filetypes(glob)
results results
end end
Hash[filetypes.flat_map do |ext, filetype| filetypes.flat_map do |ext, filetype|
expand_all(ext).map { |e| [filetype, e] } expand_all(ext).map { |e| [filetype, e] }
end.group_by { |a, b| a }.map { |a, b| [a, b.map { |c, d| d }] }.map { |a, b| end.group_by { |a, b| a }.map { |a, b| [a, b.map { |c, d| d }] }.map { |a, b|
[a, { {
extensions: b.select { |x| x.match(/^\*\.[^\/]+$/) }.map { |a| a.strip[2..] }, "name" => a,
filenames: expand_all(b.select { |x| !x.match(/^\*\.[^\/]+$/) }) "extensions" => b.select { |x| x.match(/^\*\.[^\/]+$/) }.map { |a| a.strip[2..] },
}] "filenames" => expand_all(b.select { |x| !x.match(/^\*\.[^\/]+$/) })
}] }
}
end end
def generate_plugins(packages) def generate_plugins(packages)

View File

@@ -230,3 +230,4 @@ call TestFiletype('zig')
call TestFiletype('trasys') call TestFiletype('trasys')
call TestFiletype('basic') call TestFiletype('basic')
call TestFiletype('vb') call TestFiletype('vb')
call TestFiletype('dosini')

44
syntax/dosini.vim Normal file
View File

@@ -0,0 +1,44 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'dosini') == -1
" Vim syntax file
" Language: Configuration File (ini file) for MSDOS/MS Windows
" Version: 2.2
" Original Author: Sean M. McKee <mckee@misslink.net>
" Previous Maintainer: Nima Talebi <nima@it.net.au>
" Current Maintainer: Hong Xu <hong@topbug.net>
" Homepage: http://www.vim.org/scripts/script.php?script_id=3747
" Repository: https://github.com/xuhdev/syntax-dosini.vim
" Last Change: 2018 Sep 11
" quit when a syntax file was already loaded
if exists("b:current_syntax")
finish
endif
" shut case off
syn case ignore
syn match dosiniLabel "^.\{-}\ze\s*=" nextgroup=dosiniNumber,dosiniValue
syn match dosiniValue "=\zs.*"
syn match dosiniNumber "=\zs\s*\d\+\s*$"
syn match dosiniNumber "=\zs\s*\d*\.\d\+\s*$"
syn match dosiniNumber "=\zs\s*\d\+e[+-]\=\d\+\s*$"
syn region dosiniHeader start="^\s*\[" end="\]"
syn match dosiniComment "^[#;].*$"
" Define the default highlighting.
" Only when an item doesn't have highlighting yet
hi def link dosiniNumber Number
hi def link dosiniHeader Special
hi def link dosiniComment Comment
hi def link dosiniLabel Type
hi def link dosiniValue String
let b:current_syntax = "dosini"
" vim: sts=2 sw=2 et
endif