diff --git a/syntax/svelte.vim b/syntax/svelte.vim index 57f31cb..5db9830 100644 --- a/syntax/svelte.vim +++ b/syntax/svelte.vim @@ -277,13 +277,15 @@ highlight default link cssKeyFrameProp2 Constant " Syntax patch {{{ " """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -" Patch 7.4.1142 -if has("patch-7.4-1142") - if has("win32") - syn iskeyword @,48-57,_,128-167,224-235,$ - else - syn iskeyword @,48-57,_,192-255,$ +" Add '$' to keyword characters for svelteKeyword, keeping others like '-' +" from css.vim for css keywords such as font-size +if has('patch-7.4.1142') && exists('*execute') + let s:iskeyword = matchstr(execute('syntax iskeyword'), + \ 'syntax iskeyword \zs\S\+') + if empty(s:iskeyword) || s:iskeyword ==# 'not' + let s:iskeyword = &iskeyword endif + execute 'syntax iskeyword '.s:iskeyword.',$' endif " Style diff --git a/test/cases/dollar.svelte b/test/cases/dollar.svelte new file mode 100644 index 0000000..d42b3e7 --- /dev/null +++ b/test/cases/dollar.svelte @@ -0,0 +1,16 @@ + + +
{$count}
+ + diff --git a/test/cases/dollar.vim b/test/cases/dollar.vim new file mode 100644 index 0000000..cad6b4b --- /dev/null +++ b/test/cases/dollar.vim @@ -0,0 +1,9 @@ +" $: reactive statements and $store in script, css keywords with '-' +let g:test_flatten = 1 + +function! Check() + call ExpectSyntax('$: doubled', 'svelteKeyword') + call ExpectNoSyntax('$count', 'svelteKeyword') + call ExpectSyntax('$: {', 'svelteKeyword') + call ExpectSyntax('font-size', 'cssFontProp') +endfunction