diff runtime/indent/lua.vim @ 32933:f7576cf3640f

runtime(lua): indent curly bracket followed by line comment (#12306) Commit: https://github.com/vim/vim/commit/6633611f4280f33934c2ab9b6a3e84c04f054ad3 Author: champignoom <66909116+champignoom@users.noreply.github.com> Date: Mon Aug 21 02:49:16 2023 +0800 runtime(lua): indent curly bracket followed by line comment (https://github.com/vim/vim/issues/12306) fixes https://github.com/vim/vim/issues/12305
author Christian Brabandt <cb@256bit.org>
date Sun, 20 Aug 2023 21:00:05 +0200
parents 0827d3d6d8c0
children 995bbd5ddec6
line wrap: on
line diff
--- a/runtime/indent/lua.vim
+++ b/runtime/indent/lua.vim
@@ -41,7 +41,7 @@ function! GetLuaIndent()
   let prevline = getline(prevlnum)
   let midx = match(prevline, '^\s*\%(if\>\|for\>\|while\>\|repeat\>\|else\>\|elseif\>\|do\>\|then\>\)')
   if midx == -1
-    let midx = match(prevline, '{\s*$')
+    let midx = match(prevline, '{\s*\%(--\%([^[].*\)\?\)\?$')
     if midx == -1
       let midx = match(prevline, '\<function\>\s*\%(\k\|[.:]\)\{-}\s*(')
     endif