Skip to content

Commit

Permalink
rc/filetype/lua.kak: fix indent/insert hooks not working when local i…
Browse files Browse the repository at this point in the history
…s prepended to function
  • Loading branch information
thacuber2a03 committed Feb 5, 2025
1 parent fa0105a commit 712226b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions rc/filetype/lua.kak
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ define-command -hidden lua-indent-on-new-line %[
, Kx \
<a-K>\A\h*--<ret> \
<a-K>\A[^\n]*\b(end|until)\b<ret> \
<a-k>\A(\h*\b(do|else|elseif|for|function|if|repeat|while)\b|[^\n]*[({]$|[^\n]*\bfunction\b\h*[(])<ret> \
<a-k>\A(\h*\b(do|else|elseif|for|(local\h+)?function|if|repeat|while)\b|[^\n]*[({]$|[^\n]*\bfunction\b\h*[(])<ret> \
<a-:><semicolon><a-gt>
]
]
Expand All @@ -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 \
<a-k>^\h*\b(else|elseif|do|for|function|if|while)\b|[^\n]\bfunction\b\h*[(]<ret> \
<a-k>^\h*\b(else|elseif|do|for|(local\h+)?function|if|while)\b|[^\n]\bfunction\b\h*[(]<ret> \
<a-K>\bend\b<ret>
# check that the block is empty and is not closed on a different line
execute-keys -draft <a-a>i <a-K>^[^\n]+\n[^\n]+\n<ret> jx <a-K>^<c-r>x\b(else|elseif|end)\b<ret>
Expand Down

0 comments on commit 712226b

Please sign in to comment.