From 45f2f9497524486bfc3f7651c1fb2111737aa206 Mon Sep 17 00:00:00 2001 From: Adam Stankiewicz Date: Tue, 29 Dec 2020 20:17:10 +0100 Subject: Add mint-language, closes #653 Co-authored-by: NICHTJ3 --- README.md | 3 +- autoload/polyglot/sleuth.vim | 1 + ftdetect/polyglot.vim | 4 ++ packages.yaml | 8 ++++ syntax/mint.vim | 109 +++++++++++++++++++++++++++++++++++++++++++ tests/filetypes.vim | 1 + 6 files changed, 125 insertions(+), 1 deletion(-) create mode 100644 syntax/mint.vim diff --git a/README.md b/README.md index 08a88bce..9238cd8d 100644 --- a/README.md +++ b/README.md @@ -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 599 packages it consists of. +- It **installs and updates 120+ times faster** than the 600 packages it consists of. - It is also more secure (scripts loaded for every filetype are generated by vim-polyglot) - Best syntax and indentation support (no other features). Hand-selected language packs. - Automatically detects indentation (includes performance-optimized version of [vim-sleuth](https://github.com/tpope/vim-sleuth), can be disabled) @@ -128,6 +128,7 @@ On top of all language packs from [vim repository](https://github.com/vim/vim/tr - [mathematica](https://github.com/voldikss/vim-mma) (Mathematica syntax highlighting for mathematica, cdf, m, ma, mt and 6 more files) - [mdx](https://github.com/jxnblk/vim-mdx-js) (Syntax highlighting for mdx files) - [meson](https://github.com/mesonbuild/meson/tree/master/data/syntax-highlighting/vim) (Meson syntax highlighting for wrap files) +- [mint](https://github.com/IrenejMarc/vim-mint) (Syntax highlighting for mint files) - [moonscript](https://github.com/leafo/moonscript-vim) (MoonScript syntax highlighting for moon files) - [nginx](https://github.com/chr4/nginx.vim) (Nginx syntax highlighting for nginx, nginxconf and vhost files) - [nim](https://github.com/zah/nim.vim) (Nim syntax highlighting for nim, nim.cfg, nimble, nimrod and nims files) diff --git a/autoload/polyglot/sleuth.vim b/autoload/polyglot/sleuth.vim index c10280af..155ae0b5 100644 --- a/autoload/polyglot/sleuth.vim +++ b/autoload/polyglot/sleuth.vim @@ -329,6 +329,7 @@ let s:globs = { \ 'mgl': '*.mgl', \ 'mgp': '*.mgp', \ 'mib': '*.mib,*.my', + \ 'mint': '*.mint', \ 'mix': '*.mix,*.mixal', \ 'mma': '*.mathematica,*.cdf,*.m,*.ma,*.mt,*.nb,*.nbp,*.wl,*.wlt,*.wls,*.mma', \ 'mmp': '*.mmp', diff --git a/ftdetect/polyglot.vim b/ftdetect/polyglot.vim index 44b5871d..a8a5c319 100644 --- a/ftdetect/polyglot.vim +++ b/ftdetect/polyglot.vim @@ -142,6 +142,10 @@ set cpo&vim " DO NOT EDIT CODE BELOW, IT IS GENERATED WITH MAKEFILE +if !has_key(g:polyglot_is_disabled, 'mint') + au BufNewFile,BufRead *.mint setf mint +endif + if !has_key(g:polyglot_is_disabled, 'context') au BufNewFile,BufRead *.mkii,*.mkiv,*.mkvi setf context endif diff --git a/packages.yaml b/packages.yaml index b6721e05..dc127f28 100644 --- a/packages.yaml +++ b/packages.yaml @@ -5546,3 +5546,11 @@ filetypes: patterns: - pattern: '*.mkii,*.mkiv,*.mkvi' description: ConTeXt +--- +name: mint +remote: IrenejMarc/vim-mint +filetypes: +- name: mint + patterns: + - pattern: '*.mint' + description: Mint (https://www.mint-lang.com/) diff --git a/syntax/mint.vim b/syntax/mint.vim new file mode 100644 index 00000000..2b71a692 --- /dev/null +++ b/syntax/mint.vim @@ -0,0 +1,109 @@ +if has_key(g:polyglot_is_disabled, 'mint') + finish +endif + +if exists('b:current_syntax') + let s:current_syntax = b:current_syntax + silent! unlet b:current_syntax +endif + +syntax include @JSSyntax syntax/javascript.vim +silent! unlet b:current_syntax +syntax include @XMLSyntax syntax/xml.vim +silent! unlet b:current_syntax +syntax include @CSSSyntax syntax/css.vim +silent! unlet b:current_syntax + +syntax case match +if exists('s:current_syntax') + let b:current_syntax = s:current_syntax +endif + +syntax keyword mintBlock + \ do sequence parallel if else case try catch + +syntax keyword mintCompoundType + \ Result Maybe Promise Array + +syntax keyword mintLiteralType + \ Number Bool String Object Time Html Void Never Tuple + +syntax keyword mintDeclarator + \ component module routes + +syntax keyword mintStructureDeclarator + \ enum record store provider const + +syntax keyword mintInitializer + \ fun let where next state property + +syntax keyword mintKeyword + \ decode encode return connect use + +syntax keyword mintOperator + \ "<{" "}>" "::" "=>" "|>" "<|" + +syntax keyword mintSpecifier + \ as break return using get exposing ok error just nothing void + +" String +syntax region mintString matchgroup=mintStringDelimiter start=/"/ skip=/\\"/ end=/"/ oneline +" String interpolation +syntax region mintStringInterpolation matchgroup=mintInterpolationDelimiter start="#{" end="}" contained containedin=mintString contains=@mintAll + +" Numbers +syntax match mintNumber "\v<\d+(\.\d+)?>" + +" Pascal-cased types +syntax match mintDefinedType "\v<[A-Z][A-Za-z0-9]*(\.[A-Z][A-Za-z0-9]*)*>" + + +syntax cluster mintAll contains=mintBlock,mintCompoundType,mintDeclarator,mintInitializer,mintKeyword,mintOperator,mintSpecifier,mintString + +syntax region mintEmbeddedHtmlRegion + \ start=+<\z([^ /!?<>"'=:]\+\)+ + \ start=+<\z(\s\{0}\)>+ + \ skip=++ + \ end=++ + \ end=+/>+ + \ fold + \ contains=@Spell,@XMLSyntax,@mintAll + \ keepend + +syntax region mintEmbeddedJsRegion + \ matchgroup=mintJsInterpolationQuotes + \ start="`" + \ end="`" + \ skip="\\`" + \ keepend + \ contains=mintInterpolation,@jsExpression + +hi link mintJsInterpolationQuotes Delimiter + +syntax match mintBraces /[{}]/ +syntax keyword mintStyleKeyword style skipwhite nextgroup=mintStyleIdentifier +syntax match mintStyleIdentifier /\<\k\k*/ contained skipwhite skipempty nextgroup=mintStyleBlock +syntax region mintStyleBlock contained matchgroup=mintBraces start="{" end="}" contains=@mintAll,cssDefinition,cssTagName,cssAttributeSelector,cssClassName,cssIdentifier,cssAtRule,cssAttrRegion,css.*Prop,cssComment,cssValue.*,cssColor,cssURL,cssImportant,cssCustomProp,cssError,cssStringQ,cssStringQQ,cssFunction,cssUnicodeEscape,cssVendor,cssDefinition,cssHacks,cssNoise + +" Colour links +hi link mintKeyword Keyword +hi link mintOperator Operator + +hi link mintBlock Statement +hi link mintDeclarator PreProc +hi link mintStructureDeclarator Structure +hi link mintInitializer PreProc +hi link mintSpecifier Statement + +hi link mintString String +hi link mintNumber Number + +hi link mintCompoundType Type +hi link mintLiteralType Type +hi link mintDefinedType Type + +hi link mintStringDelimiter Delimiter +hi link mintInterpolationDelimiter Special + +hi link mintStyleKeyword Type +hi link mintStyleIdentifier Statement diff --git a/tests/filetypes.vim b/tests/filetypes.vim index 5a1838b5..08d4cb93 100644 --- a/tests/filetypes.vim +++ b/tests/filetypes.vim @@ -644,6 +644,7 @@ call TestFiletype('xf86conf') call TestFiletype('xpm') call TestFiletype('xpm2') call TestFiletype('context') +call TestFiletype('mint') " DO NOT EDIT CODE ABOVE, IT IS GENERATED WITH MAKEFILE -- cgit v1.2.3