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.
- 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).
- Solid syntax and indentation support (other features skipped). Only the best language packs.
- 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)
- [dlang](https://github.com/JesseKPhillips/d.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)
- [elixir](https://github.com/elixir-lang/vim-elixir)
- [elm](https://github.com/andys8/vim-elm-syntax)

View File

@@ -57,7 +57,7 @@ let s:globs = {
\ 'dd': '*.dd',
\ 'ddoc': '*.ddoc',
\ 'dhall': '*.dhall',
\ 'dosini': '*.wrap',
\ 'dosini': '*.wrap,*.ini,*.cfg,*.dof,*.lektorproject,*.prefs,*.pro,*.properties,buildozer.spec,php.ini-*',
\ 'dsdl': '*.sdl',
\ 'dune': 'jbuild,dune,dune-project,dune-workspace',
\ 'ecrystal': '*.ecr',
@@ -110,7 +110,7 @@ let s:globs = {
\ 'javascriptreact': '*.jsx',
\ 'jinja.html': '*.jinja,*.j2,*.jinja2',
\ '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',
\ 'jsonnet': '*.jsonnet,*.libsonnet',
\ 'jst': '*.ejs,*.ect,*.jst',
@@ -130,7 +130,7 @@ let s:globs = {
\ 'markdown': '*.md,*.markdown,*.mdown,*.mdwn,*.mkd,*.mkdn,*.mkdown,*.ronn,*.workbook,contents.lr',
\ 'markdown.mdx': '*.mdx',
\ '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',
\ 'murphi': '*.m',
\ 'mustache': '*.handlebars,*.hbs,*.hulk,*.hjs,*.mustache,*.njk,*.hogan,*.hdbs,*.hb',

View File

@@ -73,6 +73,8 @@ func! s:StarSetf(ft)
endif
endfunc
augroup filetypedetect
" filetypes
if !has_key(s:disabled_packages, '8th')
@@ -95,12 +97,24 @@ if !has_key(s:disabled_packages, 'abc')
au! BufRead,BufNewFile *.abc
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')
au! BufRead,BufNewFile *.dsl
endif
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
if !has_key(s:disabled_packages, 'aidl')
@@ -111,8 +125,16 @@ if !has_key(s:disabled_packages, 'aml')
au! BufRead,BufNewFile *.aml
endif
if !has_key(s:disabled_packages, 'ampl')
au! BufRead,BufNewFile *.run
endif
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
if !has_key(s:disabled_packages, 'art')
@@ -120,11 +142,23 @@ if !has_key(s:disabled_packages, 'art')
endif
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
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
if !has_key(s:disabled_packages, 'ave')
@@ -132,19 +166,27 @@ if !has_key(s:disabled_packages, 'ave')
endif
if !has_key(s:disabled_packages, 'awk')
au! BufRead,BufNewFile *.awk
au! BufRead,BufNewFile *.awk,*.gawk
endif
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
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
if !has_key(s:disabled_packages, 'dart')
au! BufRead,BufNewFile *.dart
au! BufRead,BufNewFile *.dart,*.drt
endif
if !has_key(s:disabled_packages, 'dlang')
@@ -152,27 +194,43 @@ if !has_key(s:disabled_packages, 'dlang')
endif
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
if !has_key(s:disabled_packages, 'elm')
au! BufRead,BufNewFile *.elm
endif
if !has_key(s:disabled_packages, 'git')
au! BufRead,BufNewFile *.gitconfig
if !has_key(s:disabled_packages, 'erlang')
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
if !has_key(s:disabled_packages, 'gnuplot')
au! BufRead,BufNewFile *.gp,*.gnuplot
au! BufRead,BufNewFile *.gp,*.gpi
endif
if !has_key(s:disabled_packages, 'go')
au! BufRead,BufNewFile *.go
au! BufRead,BufNewFile *.go,*.tmpl
endif
if !has_key(s:disabled_packages, 'groovy')
au! BufRead,BufNewFile *.groovy
au! BufRead,BufNewFile *.groovy,*.gradle
endif
if !has_key(s:disabled_packages, 'haml')
@@ -187,28 +245,56 @@ if !has_key(s:disabled_packages, 'haproxy')
au! BufRead,BufNewFile *.cfg
endif
if !has_key(s:disabled_packages, 'haskell')
au! BufRead,BufNewFile *.hs,*.hs-boot,*.hsc
endif
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
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
if !has_key(s:disabled_packages, 'less')
au! BufRead,BufNewFile *.less
endif
if !has_key(s:disabled_packages, 'llvm')
au! BufRead,BufNewFile *.ll
endif
if !has_key(s:disabled_packages, 'lua')
au! BufRead,BufNewFile *.lua
au! BufRead,BufNewFile *.lua,*.nse,*.rockspec
endif
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
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
if !has_key(s:disabled_packages, 'opencl')
@@ -216,11 +302,11 @@ if !has_key(s:disabled_packages, 'opencl')
endif
if !has_key(s:disabled_packages, 'perl')
au! BufRead,BufNewFile *.perl
au! BufRead,BufNewFile *.al,*.plx,*.psgi,*.t
endif
if !has_key(s:disabled_packages, 'php')
au! BufRead,BufNewFile *.php
au! BufRead,BufNewFile *.php,*.ctp
endif
if !has_key(s:disabled_packages, 'protobuf')
@@ -228,15 +314,19 @@ if !has_key(s:disabled_packages, 'protobuf')
endif
if !has_key(s:disabled_packages, 'python')
au! BufRead,BufNewFile *.spec
au! BufRead,BufNewFile *.py,*.pyi,*.pyw,*.spec
endif
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
if !has_key(s:disabled_packages, 'raku')
au! BufRead,BufNewFile *.pod6
au! BufRead,BufNewFile *.p6,*.pl6,*.pm6,*.t,*.raku,*.rakumod,*.pod6
endif
if !has_key(s:disabled_packages, 'raml')
@@ -248,7 +338,11 @@ if !has_key(s:disabled_packages, 'rst')
endif
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
if !has_key(s:disabled_packages, 'scala')
@@ -264,7 +358,11 @@ if !has_key(s:disabled_packages, 'scss')
endif
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
if !has_key(s:disabled_packages, 'svg')
@@ -283,24 +381,44 @@ if !has_key(s:disabled_packages, 'twig')
au! BufRead,BufNewFile *.twig
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')
au! BufRead,BufNewFile *.vb
endif
if !has_key(s:disabled_packages, 'vmasm')
au! BufRead,BufNewFile *.mar
endif
if !has_key(s:disabled_packages, 'vue')
au! BufRead,BufNewFile *.vue
endif
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
if !has_key(s:disabled_packages, 'xsl')
au! BufRead,BufNewFile *.xslt
au! BufRead,BufNewFile *.xslt,*.xsl
endif
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
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-project 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 mcmod.info setf json
endif
@@ -1021,6 +1140,7 @@ if !has_key(s:disabled_packages, 'mathematica')
au BufNewFile,BufRead *.cdf setf mma
au BufNewFile,BufRead *.ma setf mma
au BufNewFile,BufRead *.mathematica setf mma
au BufNewFile,BufRead *.mma setf mma
au BufNewFile,BufRead *.mt setf mma
au BufNewFile,BufRead *.nb 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()
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
augroup END
au BufNewFile,BufRead,StdinReadPost *
\ if !did_filetype() && expand("<afile>") !~ g:ft_ignore_pat
\ | 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:
- jsonp
- template
extra_filenames:
- Pipfile.lock
---
name: jsonnet
remote: google/vim-jsonnet
@@ -1025,6 +1027,7 @@ filetypes:
linguist: Mathematica
extra_extensions:
- wls
- mma
---
name: markdown
remote: plasticboy/vim-markdown
@@ -1808,3 +1811,19 @@ filetypes:
- sba
ignored_warnings:
- 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
puts deps["javascript"]
each_node = lambda {|&b| packages.keys.each(&b) }
each_child = lambda {|n, &b| deps[n].each(&b) }
@@ -433,21 +432,15 @@ def generate_ftdetect(packages, heuristics)
ambiguous_extensions = extensions
.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_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
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
native_extensions = Set.new(native_filetypes.flat_map { |f| f["extensions"] || [] })
for package in packages
name = package.fetch("name")
@@ -456,7 +449,7 @@ def generate_ftdetect(packages, heuristics)
for filetype in package["filetypes"]
for extension in filetype["extensions"]
if native_filetypes.has_key?(extension)
if native_extensions.include?(extension)
to_disable << "*." + extension
end
end
@@ -492,20 +485,6 @@ def generate_ftdetect(packages, heuristics)
extensions = filetype["extensions"]
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
outer_filetype = filetype["outer_filetype"]
if outer_filetype
@@ -549,6 +528,24 @@ def generate_ftdetect(packages, heuristics)
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')
File.write('ftdetect/polyglot.vim', ftdetect.gsub(/(?<=" filetypes\n).*(?=\n" end filetypes)/m, output))
@@ -728,14 +725,15 @@ def detect_filetypes(glob)
results
end
Hash[filetypes.flat_map do |ext, filetype|
filetypes.flat_map do |ext, filetype|
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|
[a, {
extensions: b.select { |x| x.match(/^\*\.[^\/]+$/) }.map { |a| a.strip[2..] },
filenames: expand_all(b.select { |x| !x.match(/^\*\.[^\/]+$/) })
}]
}]
{
"name" => a,
"extensions" => b.select { |x| x.match(/^\*\.[^\/]+$/) }.map { |a| a.strip[2..] },
"filenames" => expand_all(b.select { |x| !x.match(/^\*\.[^\/]+$/) })
}
}
end
def generate_plugins(packages)

View File

@@ -230,3 +230,4 @@ call TestFiletype('zig')
call TestFiletype('trasys')
call TestFiletype('basic')
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