From 29ea396c311d9f1992c5e876752f2c50f05316c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ensar=20Saraj=C4=8Di=C4=87?= Date: Sun, 27 Dec 2020 15:23:29 +0100 Subject: Improve VimL regex highlighting **NOTES:** - PR is not yet merged in upstream repository (https://github.com/SalGnt/Sublime-VimL/pull/12), but sublime-syntax file is already updated with changes. - Updated syntax test files are added as well This fixes #1064 --- assets/syntaxes.bin | Bin 678334 -> 679131 bytes assets/syntaxes/02_Extra/VimL.sublime-syntax | 4 ++-- tests/syntax-tests/highlighted/VimL/source.vim | 13 ++++++++++--- tests/syntax-tests/source/VimL/source.vim | 9 ++++++++- 4 files changed, 20 insertions(+), 6 deletions(-) diff --git a/assets/syntaxes.bin b/assets/syntaxes.bin index 71c64c84..c1f3051e 100644 Binary files a/assets/syntaxes.bin and b/assets/syntaxes.bin differ diff --git a/assets/syntaxes/02_Extra/VimL.sublime-syntax b/assets/syntaxes/02_Extra/VimL.sublime-syntax index f2b202c3..3f96a985 100644 --- a/assets/syntaxes/02_Extra/VimL.sublime-syntax +++ b/assets/syntaxes/02_Extra/VimL.sublime-syntax @@ -75,10 +75,10 @@ contexts: - match: '''(''''|\n[^\S\n]*\\|[^\n''])*''' scope: string.quoted.single.viml string_regex: - - match: '/(\\\\|\\/|\n[^\S\n]*\\|[^\n/])*/' + - match: '[gvs]{1}/(\\\\|\\/|\n[^\S\n]*\\|[^\n/])*/' scope: string.regexp.viml support_function: - - match: \b(set(local|global)?|let|command|filetype|colorscheme|\w*map|\w*a(b|brev)?|syn|exe(c|cute)?|ec(ho|)?|au(tocmd|)?)\b + - match: \b(set(local|global)?|let|command|filetype|syntax|colorscheme|\w*map|\w*a(b|brev)?|syn|exe(c|cute)?|ec(ho|)?|au(tocmd|)?)\b scope: support.function.viml support_type: - match: <.*?> diff --git a/tests/syntax-tests/highlighted/VimL/source.vim b/tests/syntax-tests/highlighted/VimL/source.vim index 37c4e953..77a5638c 100644 --- a/tests/syntax-tests/highlighted/VimL/source.vim +++ b/tests/syntax-tests/highlighted/VimL/source.vim @@ -53,6 +53,7 @@ command! -nargs=? Echo :call EchoFunc() +" TODO test stuff let g:global = "global var" let s:script_var = "script var" let w:window_var = "window war" @@ -67,19 +68,25 @@ echo "Hello" == "Hello2" echo "Hello" is "Hello2" echo "Hello" isnot "Hello2" -echo "Hello" =~ "Hello2" +echo "Hello" =~ 'xx*' echo "Hello" !~ "Hello2" echo "Hello" !~ "Hello2" echo "/This/should/not/be/a/regex" " Error case from issue #1604 (https://github.com/sharkdp/bat/issues/1064) -set runtimepath=~/foo/bar +set runtimepath=~/foo/bar + +silent g/Aap/p let g:dict = {} let g:dict.item = ['l1', 'l2'] let g:dict2 = {'dict_item': ['l1', 'l2'], 'di2': 'x'} +silent g/regex/ +silent v/regex/ +silent %s/regex/not_regex/ + filetype plugin indent on -syntax enable +syntax enable diff --git a/tests/syntax-tests/source/VimL/source.vim b/tests/syntax-tests/source/VimL/source.vim index 15cd3a81..3b1f35f8 100644 --- a/tests/syntax-tests/source/VimL/source.vim +++ b/tests/syntax-tests/source/VimL/source.vim @@ -53,6 +53,7 @@ imap =HelloWorld("World") command! -nargs=? Echo :call EchoFunc() +" TODO test stuff let g:global = "global var" let s:script_var = "script var" let w:window_var = "window war" @@ -67,7 +68,7 @@ echo "Hello" ==? "Hello2" echo "Hello" == "Hello2" echo "Hello" is "Hello2" echo "Hello" isnot "Hello2" -echo "Hello" =~ "Hello2" +echo "Hello" =~ 'xx*' echo "Hello" !~ "Hello2" echo "Hello" !~ "Hello2" @@ -76,10 +77,16 @@ echo "/This/should/not/be/a/regex" " Error case from issue #1604 (https://github.com/sharkdp/bat/issues/1064) set runtimepath=~/foo/bar +silent g/Aap/p + let g:dict = {} let g:dict.item = ['l1', 'l2'] let g:dict2 = {'dict_item': ['l1', 'l2'], 'di2': 'x'} +silent g/regex/ +silent v/regex/ +silent %s/regex/not_regex/ + filetype plugin indent on syntax enable -- cgit v1.2.3