]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
runtime(nginx): highlight Lua in set_by_lua_block in syntax script
authorJosef Schönberger <josef.schoenberger@tum.de>
Sun, 8 Feb 2026 21:19:20 +0000 (21:19 +0000)
committerChristian Brabandt <cb@256bit.org>
Sun, 8 Feb 2026 21:19:20 +0000 (21:19 +0000)
The set_by_lua_block directive of the Lua module takes an additional
variable as an argument which currently breaks the detection of inline
Lua blocks. For example:

    set_by_lua_block $myvar {
        return tonumber(ngx.var.myothervar)-1
    }

closes: #19362

Signed-off-by: Josef Schönberger <josef.schoenberger@tum.de>
Signed-off-by: Christian Brabandt <cb@256bit.org>
runtime/syntax/nginx.vim

index ad8bdbf3594acfcd3a1ea1f37f4c8e7103fdeee5..b9aa85f482acfcd26c4decaefcc1f4715b47d6f2 100644 (file)
@@ -2302,7 +2302,7 @@ let b:current_syntax = "nginx"
 " Enable nested LUA syntax highlighting
 unlet b:current_syntax
 syn include @LUA syntax/lua.vim
-syn region ngxLua start=+^\s*\w\+_by_lua_block\s*{+ end=+}+me=s-1 contains=ngxBlock,@LUA
+syn region ngxLua start=+^\s*\w\+_by_lua_block\s*\(\$\w\+\s*\)\?{+ end=+}+me=s-1 contains=ngxBlock,@LUA
 let b:current_syntax = "nginx"