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
This commit is contained in:
Ensar Sarajčić 2020-12-27 15:23:29 +01:00 committed by David Peter
parent 171d215f91
commit 29ea396c31
4 changed files with 20 additions and 6 deletions

BIN
assets/syntaxes.bin vendored

Binary file not shown.

View File

@ -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: <.*?>

View File

@ -53,6 +53,7 @@
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,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

View File

@ -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