From 5013d8b1998412404f7dacfd848c53a8f0fc9c21 Mon Sep 17 00:00:00 2001 From: Virginia Senioria <91khr@users.noreply.github.com> Date: Sat, 13 Nov 2021 13:42:45 +0800 Subject: [PATCH] Fixed for lua long bracket strings Besides, added test for lua --- autoload/rainbow_main.vim | 3 +++ tests/test.lua | 12 ++++++++++++ 2 files changed, 15 insertions(+) create mode 100644 tests/test.lua diff --git a/autoload/rainbow_main.vim b/autoload/rainbow_main.vim index 619351b..a68a3ca 100644 --- a/autoload/rainbow_main.vim +++ b/autoload/rainbow_main.vim @@ -41,6 +41,9 @@ let s:rainbow_conf = { \ 'html': { \ 'parentheses': ['start=/\v\<((script|style|area|base|br|col|embed|hr|img|input|keygen|link|menuitem|meta|param|source|track|wbr)[ >])@!\z([-_:a-zA-Z0-9]+)(\s+[-_:a-zA-Z0-9]+(\=("[^"]*"|'."'".'[^'."'".']*'."'".'|[^ '."'".'"><=`]*))?)*\>/ end=## fold'], \ }, +\ 'lua': { +\ 'parentheses': ["start=/(/ end=/)/", "start=/{/ end=/}/", "start=/\\v\\[\\ze($|[^[])/ end=/\\]/"], +\ }, \ 'perl': { \ 'syn_name_prefix': 'perlBlockFoldRainbow', \ }, diff --git a/tests/test.lua b/tests/test.lua new file mode 100644 index 0000000..15e369d --- /dev/null +++ b/tests/test.lua @@ -0,0 +1,12 @@ +(function(args) + lst = { a=function(arg) print("hello") end, + b=(1+2)*3/4, + [3+5]={ ["hello"]=("hi") }, + } + lst[ + (function() return 0 end)()] = 1 +end)("blah") + +[[ +Special lua string... +]]