diff --git a/rc/filetype/lua.kak b/rc/filetype/lua.kak index 148db983fe..070ac00584 100644 --- a/rc/filetype/lua.kak +++ b/rc/filetype/lua.kak @@ -118,7 +118,7 @@ define-command -hidden lua-indent-on-new-line %[ , Kx \ \A\h*-- \ \A[^\n]*\b(end|until)\b \ - \A(\h*\b(do|else|elseif|for|function|if|repeat|while)\b|[^\n]*[({]$|[^\n]*\bfunction\b\h*[(]) \ + \A(\h*\b(do|else|elseif|for|(local\h+)?function|if|repeat|while)\b|[^\n]*[({]$|[^\n]*\bfunction\b\h*[(]) \ ] ] @@ -136,7 +136,7 @@ define-command -hidden lua-insert-on-new-line %[ # check that starts with a block keyword that is not closed on the same line execute-keys -draft \ kx \ - ^\h*\b(else|elseif|do|for|function|if|while)\b|[^\n]\bfunction\b\h*[(] \ + ^\h*\b(else|elseif|do|for|(local\h+)?function|if|while)\b|[^\n]\bfunction\b\h*[(] \ \bend\b # check that the block is empty and is not closed on a different line execute-keys -draft i ^[^\n]+\n[^\n]+\n jx ^x\b(else|elseif|end)\b