diff options
author | Ensar Sarajčić <es.ensar@gmail.com> | 2020-12-27 15:23:29 +0100 |
---|---|---|
committer | David Peter <sharkdp@users.noreply.github.com> | 2020-12-28 09:33:32 +0100 |
commit | 29ea396c311d9f1992c5e876752f2c50f05316c2 (patch) | |
tree | 0d9323e98bcf82bd203fa10c4b5aa4b5775eadb2 | |
parent | 171d215f910cd21e6ec07eac20a05b0403444b48 (diff) |
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
-rw-r--r-- | assets/syntaxes.bin | bin | 678334 -> 679131 bytes | |||
-rw-r--r-- | assets/syntaxes/02_Extra/VimL.sublime-syntax | 4 | ||||
-rw-r--r-- | tests/syntax-tests/highlighted/VimL/source.vim | 13 | ||||
-rw-r--r-- | 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 Binary files differindex 71c64c84..c1f3051e 100644 --- a/assets/syntaxes.bin +++ b/assets/syntaxes.bin 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 @@ [38;2;102;217;239mcommand[0m[38;2;248;248;242m! [0m[3;38;2;166;226;46m-nargs=[0m[38;2;248;248;242m? Echo :call [0m[38;2;102;217;239mEchoFunc[0m[38;2;248;248;242m([0m[3;38;2;166;226;46m<args>[0m[38;2;248;248;242m)[0m +[38;2;117;113;94m" TODO test stuff[0m [38;2;102;217;239mlet[0m[38;2;248;248;242m [0m[38;2;255;255;255mg:global[0m[38;2;248;248;242m = [0m[38;2;230;219;116m"global var"[0m [38;2;102;217;239mlet[0m[38;2;248;248;242m [0m[38;2;255;255;255ms:script_var[0m[38;2;248;248;242m = [0m[38;2;230;219;116m"script var"[0m [38;2;102;217;239mlet[0m[38;2;248;248;242m [0m[38;2;255;255;255mw:window_var[0m[38;2;248;248;242m = [0m[38;2;230;219;116m"window war"[0m @@ -67,19 +68,25 @@ [38;2;102;217;239mecho[0m[38;2;248;248;242m [0m[38;2;230;219;116m"Hello"[0m[38;2;248;248;242m [0m[38;2;249;38;114m==[0m[38;2;248;248;242m [0m[38;2;230;219;116m"Hello2"[0m [38;2;102;217;239mecho[0m[38;2;248;248;242m [0m[38;2;230;219;116m"Hello"[0m[38;2;248;248;242m is [0m[38;2;230;219;116m"Hello2"[0m [38;2;102;217;239mecho[0m[38;2;248;248;242m [0m[38;2;230;219;116m"Hello"[0m[38;2;248;248;242m [0m[38;2;249;38;114misnot[0m[38;2;248;248;242m [0m[38;2;230;219;116m"Hello2"[0m -[38;2;102;217;239mecho[0m[38;2;248;248;242m [0m[38;2;230;219;116m"Hello"[0m[38;2;248;248;242m [0m[38;2;249;38;114m=~[0m[38;2;248;248;242m [0m[38;2;230;219;116m"Hello2"[0m +[38;2;102;217;239mecho[0m[38;2;248;248;242m [0m[38;2;230;219;116m"Hello"[0m[38;2;248;248;242m [0m[38;2;249;38;114m=~[0m[38;2;248;248;242m [0m[38;2;230;219;116m'xx*'[0m [38;2;102;217;239mecho[0m[38;2;248;248;242m [0m[38;2;230;219;116m"Hello"[0m[38;2;248;248;242m [0m[38;2;249;38;114m!~[0m[38;2;248;248;242m [0m[38;2;230;219;116m"Hello2"[0m [38;2;102;217;239mecho[0m[38;2;248;248;242m [0m[38;2;230;219;116m"Hello"[0m[38;2;248;248;242m [0m[38;2;249;38;114m!~[0m[38;2;248;248;242m [0m[38;2;230;219;116m"Hello2"[0m [38;2;102;217;239mecho[0m[38;2;248;248;242m [0m[38;2;230;219;116m"/This/should/not/be/a/regex"[0m [38;2;117;113;94m" Error case from issue #1604 (https://github.com/sharkdp/bat/issues/1064)[0m -[38;2;102;217;239mset[0m[38;2;248;248;242m runtimepath[0m[38;2;249;38;114m=~[0m[38;2;246;170;17m/foo/[0m[38;2;248;248;242mbar[0m +[38;2;102;217;239mset[0m[38;2;248;248;242m runtimepath[0m[38;2;249;38;114m=~[0m[38;2;248;248;242m/foo/bar[0m + +[38;2;248;248;242msilent [0m[38;2;246;170;17mg/Aap/[0m[38;2;248;248;242mp[0m [38;2;102;217;239mlet[0m[38;2;248;248;242m [0m[38;2;255;255;255mg:dict[0m[38;2;248;248;242m = {}[0m [38;2;102;217;239mlet[0m[38;2;248;248;242m [0m[38;2;255;255;255mg:dict[0m[38;2;249;38;114m.[0m[38;2;248;248;242mitem = [[0m[38;2;230;219;116m'l1'[0m[38;2;248;248;242m, [0m[38;2;230;219;116m'l2'[0m[38;2;248;248;242m][0m [38;2;102;217;239mlet[0m[38;2;248;248;242m [0m[38;2;255;255;255mg:dict2[0m[38;2;248;248;242m = {[0m[38;2;230;219;116m'dict_item'[0m[38;2;248;248;242m: [[0m[38;2;230;219;116m'l1'[0m[38;2;248;248;242m, [0m[38;2;230;219;116m'l2'[0m[38;2;248;248;242m], [0m[38;2;230;219;116m'di2'[0m[38;2;248;248;242m: [0m[38;2;230;219;116m'x'[0m[38;2;248;248;242m}[0m +[38;2;248;248;242msilent [0m[38;2;246;170;17mg/regex/[0m +[38;2;248;248;242msilent [0m[38;2;246;170;17mv/regex/[0m +[38;2;248;248;242msilent [0m[38;2;249;38;114m%[0m[38;2;246;170;17ms/regex/[0m[38;2;248;248;242mnot_regex/[0m + [38;2;102;217;239mfiletype[0m[38;2;248;248;242m plugin indent on[0m -[38;2;248;248;242msyntax enable[0m +[38;2;102;217;239msyntax[0m[38;2;248;248;242m enable[0m 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 <C-h> <C-r>=HelloWorld("World")<CR> command! -nargs=? Echo :call EchoFunc(<args>) +" 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 |