Add 'else' to auto deindent/align logic in context of 'case' statement

This commit is contained in:
John Isom 2020-08-01 12:12:48 -06:00
parent dbb548af2d
commit e858df3ca2

View File

@ -190,8 +190,8 @@ define-command -hidden crystal-indent-on-char %{
evaluate-commands -no-hooks -draft -itersel %{
# align 'else/elsif' to 'if'
try %{ execute-keys -draft <a-x> <a-k> ^\h*(?:else|elsif)$ <ret> <a-a>i <a-semicolon> <a-?> ^\h*(?:if) <ret> <a-S> 1<a-&> }
# align 'when' to 'case'
try %{ execute-keys -draft <a-x> <a-k> ^\h*(?:when)$ <ret> <a-a>i <a-semicolon> <a-?> ^\h*(?:case) <ret> <a-S> 1<a-&> }
# align 'else/when' to 'case'
try %{ execute-keys -draft <a-x> <a-k> ^\h*(?:else|when)$ <ret> <a-a>i <a-semicolon> <a-?> ^\h*(?:case) <ret> <a-S> 1<a-&> }
# align 'rescue' to 'begin/def'
try %{ execute-keys -draft <a-x> <a-k> ^\h*(?:rescue)$ <ret> <a-a>i <a-semicolon> <a-?> ^\h*(?:begin|def) <ret> <a-S> 1<a-&> }
# align 'end' to opening structure