mirror of
https://github.com/sheerun/vim-polyglot.git
synced 2025-11-08 11:33:52 -05:00
Fix svelte branch name, closes #522
This commit is contained in:
@@ -183,7 +183,7 @@ syn match crystalPredefinedConstant "\%(\%(\.\@1<!\.\)\@2<!\|::\)\_s*\zs\%(STDER
|
||||
syn match crystalPredefinedConstant "\%(\%(\.\@1<!\.\)\@2<!\|::\)\_s*\zs\%(crystal_\%(VERSION\|RELEASE_DATE\|PLATFORM\|PATCHLEVEL\|REVISION\|DESCRIPTION\|COPYRIGHT\|ENGINE\)\)\>\%(\s*(\)\@!"
|
||||
|
||||
" Normal Regular Expression
|
||||
SynFold '/' syn region crystalRegexp matchgroup=crystalRegexpDelimiter start="\%(\%(^\|\<\%(and\|or\|while\|until\|unless\|if\|elsif\|ifdef\|when\|not\|then\|else\)\|[;\~=!|&(,[<>?:*+-]\)\s*\)\@<=/" end="/[imx]*" skip="\\\\\|\\/" contains=@crystalRegexpSpecial
|
||||
SynFold '/' syn region crystalRegexp matchgroup=crystalRegexpDelimiter start="\%(\%(^\|\<\%(and\|or\|while\|until\|unless\|if\|elsif\|ifdef\|when\|in\|not\|then\|else\)\|[;\~=!|&(,[<>?:*+-]\)\s*\)\@<=/" end="/[imx]*" skip="\\\\\|\\/" contains=@crystalRegexpSpecial
|
||||
SynFold '/' syn region crystalRegexp matchgroup=crystalRegexpDelimiter start="\%(\h\k*\s\+\)\@<=/[ \t=/]\@!" end="/[imx]*" skip="\\\\\|\\/" contains=@crystalRegexpSpecial
|
||||
|
||||
" Generalized Regular Expression
|
||||
@@ -315,7 +315,7 @@ if !exists('b:crystal_no_expensive') && !exists('g:crystal_no_expensive')
|
||||
SynFold 'select' syn region crystalSelectExpression matchgroup=crystalConditional start="\<select\>" end="\<end\>" contains=TOP
|
||||
SynFold 'if' syn region crystalConditionalExpression matchgroup=crystalConditional start="\%(\%(^\|\.\.\.\=\|[{:,;([<>~\*/%&^|+=-]\|\%(\<[_[:lower:]][_[:alnum:]]*\)\@<![?!]\)\s*\)\@<=\%(if\|ifdef\|unless\)\>" end="\%(\%(\%(\.\@1<!\.\)\|::\)\s*\)\@<!\<end\>" contains=TOP
|
||||
|
||||
syn match crystalConditional "\<\%(then\|else\|when\)\>[?!]\@!" contained containedin=crystalCaseExpression
|
||||
syn match crystalConditional "\<\%(then\|else\|when\|in\)\>[?!]\@!" contained containedin=crystalCaseExpression
|
||||
syn match crystalConditional "\<\%(when\|else\)\>[?!]\@!" contained containedin=crystalSelectExpression
|
||||
syn match crystalConditional "\<\%(then\|else\|elsif\)\>[?!]\@!" contained containedin=crystalConditionalExpression
|
||||
|
||||
@@ -339,7 +339,7 @@ else
|
||||
syn match crystalControl "\<macro\>[?!]\@!" nextgroup=crystalMacroDeclaration skipwhite skipnl
|
||||
syn match crystalControl "\<enum\>[?!]\@!" nextgroup=crystalEnumDeclaration skipwhite skipnl
|
||||
syn match crystalControl "\<annotation\>[?!]\@!" nextgroup=crystalAnnotationDeclaration skipwhite skipnl
|
||||
syn match crystalControl "\<\%(case\|begin\|do\|if\|ifdef\|unless\|while\|until\|else\|elsif\|ensure\|then\|when\|end\)\>[?!]\@!"
|
||||
syn match crystalControl "\<\%(case\|begin\|do\|if\|ifdef\|unless\|while\|until\|else\|elsif\|ensure\|then\|when\|in\|end\)\>[?!]\@!"
|
||||
syn match crystalKeyword "\<\%(alias\|undef\)\>[?!]\@!"
|
||||
endif
|
||||
|
||||
@@ -402,7 +402,7 @@ SynFold '#' syn region crystalMultilineComment start="\%(\%(^\s*#.*\n\)\@<!\%(^\
|
||||
syn match crystalKeywordAsMethod "\%(\%(\.\@1<!\.\)\|::\)\_s*\%(alias\|begin\|break\|case\|class\|def\|defined\|do\|else\|select\)\>" transparent contains=NONE
|
||||
syn match crystalKeywordAsMethod "\%(\%(\.\@1<!\.\)\|::\)\_s*\%(elsif\|end\|ensure\|false\|for\|if\|ifdef\|in\|module\|next\|nil\)\>" transparent contains=NONE
|
||||
syn match crystalKeywordAsMethod "\%(\%(\.\@1<!\.\)\|::\)\_s*\%(rescue\|return\|self\|super\|previous_def\|then\|true\)\>" transparent contains=NONE
|
||||
syn match crystalKeywordAsMethod "\%(\%(\.\@1<!\.\)\|::\)\_s*\%(undef\|unless\|until\|when\|while\|yield\|with\|__FILE__\|__LINE__\)\>" transparent contains=NONE
|
||||
syn match crystalKeywordAsMethod "\%(\%(\.\@1<!\.\)\|::\)\_s*\%(undef\|unless\|until\|when\|in\|while\|yield\|with\|__FILE__\|__LINE__\)\>" transparent contains=NONE
|
||||
|
||||
syn match crystalKeywordAsMethod "\<\%(alias\|begin\|case\|class\|def\|do\|end\)[?!]" transparent contains=NONE
|
||||
syn match crystalKeywordAsMethod "\<\%(if\|ifdef\|module\|undef\|unless\|until\|while\)[?!]" transparent contains=NONE
|
||||
|
||||
126
syntax/svelte.vim
Normal file
126
syntax/svelte.vim
Normal file
@@ -0,0 +1,126 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'svelte') == -1
|
||||
|
||||
" Vim syntax file
|
||||
" Language: Svelte 3 (HTML/JavaScript)
|
||||
" Author: Evan Lecklider <evan@lecklider.com>
|
||||
" Maintainer: Evan Lecklide <evan@lecklider.com>
|
||||
" Depends: pangloss/vim-javascript
|
||||
" URL: https://github.com/evanleck/vim-svelte
|
||||
"
|
||||
" Like vim-jsx, this depends on the pangloss/vim-javascript syntax package (and
|
||||
" is tested against it exclusively). If you're using vim-polyglot, then you're
|
||||
" all set.
|
||||
|
||||
if exists("b:current_syntax")
|
||||
finish
|
||||
endif
|
||||
|
||||
" Read HTML to begin with.
|
||||
runtime! syntax/html.vim
|
||||
unlet! b:current_syntax
|
||||
|
||||
" Expand HTML tag names to include mixed case, periods, and colons.
|
||||
syntax match htmlTagName contained "\<[a-zA-Z:\.]*\>"
|
||||
|
||||
" Special attributes that include some kind of binding e.g. "on:click",
|
||||
" "bind:something", etc.
|
||||
syntax match svelteKeyword "\<[a-z]\+:[a-zA-Z|]\+=" contained containedin=htmlTag
|
||||
|
||||
" Mixed-case attributes are likely props.
|
||||
syntax match svelteKeyword "\<[a-z]\+:[a-zA-Z|]\+=" contained containedin=htmlTag
|
||||
|
||||
" The "slot" attribute has special meaning.
|
||||
syntax keyword svelteKeyword slot contained containedin=htmlTag
|
||||
|
||||
" According to vim-jsx, you can let jsBlock take care of ending the region.
|
||||
" https://github.com/mxw/vim-jsx/blob/master/after/syntax/jsx.vim
|
||||
syntax region svelteExpression start="{" end="" contains=jsBlock,javascriptBlock containedin=htmlString,htmlTag,htmlArg,htmlValue,htmlH1,htmlH2,htmlH3,htmlH4,htmlH5,htmlH6,htmlHead,htmlTitle,htmlBoldItalicUnderline,htmlUnderlineBold,htmlUnderlineItalicBold,htmlUnderlineBoldItalic,htmlItalicUnderline,htmlItalicBold,htmlItalicBoldUnderline,htmlItalicUnderlineBold,htmlLink,htmlLeadingSpace,htmlBold,htmlBoldUnderline,htmlBoldItalic,htmlBoldUnderlineItalic,htmlUnderline,htmlUnderlineItalic,htmlItalic,htmlStrike,javaScript
|
||||
|
||||
syntax region svelteSurroundingTag contained start=+<\(script\|style\|template\)+ end=+>+ fold contains=htmlTagN,htmlString,htmlArg,htmlValue,htmlTagError,htmlEvent
|
||||
|
||||
" Block conditionals.
|
||||
syntax match svelteConditional "#if" contained containedin=jsBlock,javascriptBlock
|
||||
syntax match svelteConditional "/if" contained containedin=jsBlock,javascriptBlock
|
||||
syntax match svelteConditional ":else if" contained containedin=jsBlock,javascriptBlock
|
||||
syntax match svelteConditional ":else" contained containedin=jsBlock,javascriptBlock
|
||||
|
||||
" Block keywords.
|
||||
syntax match svelteKeyword "#await" contained containedin=jsBlock,javascriptBlock
|
||||
syntax match svelteKeyword "/await" contained containedin=jsBlock,javascriptBlock
|
||||
syntax match svelteKeyword ":catch" contained containedin=jsBlock,javascriptBlock
|
||||
syntax match svelteKeyword ":then" contained containedin=jsBlock,javascriptBlock
|
||||
|
||||
" Inline keywords.
|
||||
syntax match svelteKeyword "@html" contained containedin=jsBlock,javascriptBlock
|
||||
syntax match svelteKeyword "@debug" contained containedin=jsBlock,javascriptBlock
|
||||
|
||||
" Repeat functions.
|
||||
syntax match svelteRepeat "#each" contained containedin=jsBlock,javascriptBlock
|
||||
syntax match svelteRepeat "/each" contained containedin=jsBlock,javascriptBlock
|
||||
|
||||
highlight def link svelteConditional Conditional
|
||||
highlight def link svelteKeyword Keyword
|
||||
highlight def link svelteRepeat Repeat
|
||||
|
||||
" Preprocessed languages that aren't supported out of the box by Svelte require
|
||||
" additional syntax files to be pulled in and can slow Vim down a bit. For that
|
||||
" reason, preprocessed languages must be enabled manually. Note that some may
|
||||
" require additional plugins that contain the actual syntax definitions.
|
||||
"
|
||||
" Heavily cribbed from https://github.com/posva/vim-vue and largely completed by
|
||||
" @davidroeca (thank you!).
|
||||
|
||||
" A syntax should be registered if there's a valid syntax definition known to
|
||||
" Vim and it is enabled for the Svelte plugin.
|
||||
function! s:enabled(language)
|
||||
" Check whether a syntax file for {language} exists
|
||||
if empty(globpath(&runtimepath, 'syntax/' . a:language . '.vim'))
|
||||
return 0
|
||||
endif
|
||||
|
||||
" If g:svelte_preprocessors is set, check for it there, otherwise return 0.
|
||||
if exists('g:svelte_preprocessors') && type(g:svelte_preprocessors) == v:t_list
|
||||
return index(g:svelte_preprocessors, a:language) != -1
|
||||
else
|
||||
return 0
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" Default tag definitions.
|
||||
let s:languages = [
|
||||
\ { 'name': 'less', 'tag': 'style' },
|
||||
\ { 'name': 'scss', 'tag': 'style' },
|
||||
\ { 'name': 'sass', 'tag': 'style' },
|
||||
\ { 'name': 'stylus', 'tag': 'style' },
|
||||
\ { 'name': 'typescript', 'tag': 'script' },
|
||||
\ ]
|
||||
|
||||
" Add global tag definitions to our defaults.
|
||||
if exists('g:svelte_preprocessor_tags') && type('g:svelte_preprocessor_tags') == v:t_list
|
||||
let s:languages += g:svelte_preprocessor_tags
|
||||
endif
|
||||
|
||||
for s:language in s:languages
|
||||
let s:attr = '\(lang\|type\)=\("\|''\)[^\2]*' . s:language.name . '[^\2]*\2'
|
||||
let s:start = '<' . s:language.tag . '\>\_[^>]*' . s:attr . '\_[^>]*>'
|
||||
|
||||
if s:enabled(s:language.name)
|
||||
execute 'syntax include @' . s:language.name . ' syntax/' . get(s:language, 'as', s:language.name) . '.vim'
|
||||
unlet! b:current_syntax
|
||||
|
||||
execute 'syntax region svelte_' . s:language.name
|
||||
\ 'keepend'
|
||||
\ 'start=/' . s:start . '/'
|
||||
\ 'end="</' . s:language.tag . '>"me=s-1'
|
||||
\ 'contains=@' . s:language.name . ',svelteSurroundingTag'
|
||||
\ 'fold'
|
||||
endif
|
||||
endfor
|
||||
|
||||
" Cybernetically enhanced web apps.
|
||||
let b:current_syntax = "svelte"
|
||||
|
||||
" Sync from start because of the wacky nesting.
|
||||
syntax sync fromstart
|
||||
|
||||
endif
|
||||
@@ -248,7 +248,7 @@ syn match sdServiceKey contained /^StartLimitBurst=/ nextgroup=sdUInt,sdErr
|
||||
syn match sdServiceKey contained /^FailureAction=/ nextgroup=sdLimitAction,sdFailAction,sdErr
|
||||
syn match sdServiceKey contained /^\%(RestartPrevent\|RestartForce\|Success\)ExitStatus=/ nextgroup=sdExitStatus,sdErr
|
||||
syn match sdServiceKey contained /^RebootArgument=/
|
||||
syn keyword sdServiceType contained nextgroup=sdErr simple forking dbus oneshot notify idle
|
||||
syn keyword sdServiceType contained nextgroup=sdErr simple exec forking dbus oneshot notify idle
|
||||
syn keyword sdRestartType contained nextgroup=sdErr no on-success on-failure on-abort always
|
||||
syn keyword sdNotifyType contained nextgroup=sdErr none main all
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'vifm') == -1
|
||||
|
||||
" vifm syntax file
|
||||
" Maintainer: xaizek <xaizek@posteo.net>
|
||||
" Last Change: July 27, 2020
|
||||
" Last Change: August 8, 2020
|
||||
" Inspired By: Vim syntax file by Dr. Charles E. Campbell, Jr.
|
||||
|
||||
if exists('b:current_syntax')
|
||||
@@ -89,7 +89,7 @@ syntax case ignore
|
||||
syntax keyword vifmHiGroups contained WildMenu Border Win CmdLine CurrLine
|
||||
\ OtherLine Directory Link Socket Device Executable Selected BrokenLink
|
||||
\ TopLine TopLineSel StatusLine JobLine SuggestBox Fifo ErrorMsg CmpMismatch
|
||||
\ AuxWin OtherWin TabLine TabLineSel TabNr HardLink LineNr OddLine
|
||||
\ AuxWin OtherWin TabLine TabLineSel TabNr TabNrSel HardLink LineNr OddLine
|
||||
\ User1 User2 User3 User4 User5 User6 User7 User8 User9
|
||||
syntax keyword vifmHiStyles contained
|
||||
\ bold underline reverse inverse standout italic none
|
||||
|
||||
Reference in New Issue
Block a user