From 6cf39a5f4f8e2e0fbc36389992287d61c32afe55 Mon Sep 17 00:00:00 2001 From: John Isom Date: Sun, 2 Aug 2020 11:22:28 -0600 Subject: [PATCH] Fix auto indentation for if/case and else --- rc/filetype/crystal.kak | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/rc/filetype/crystal.kak b/rc/filetype/crystal.kak index 74c283d8..9f1e7210 100644 --- a/rc/filetype/crystal.kak +++ b/rc/filetype/crystal.kak @@ -188,14 +188,16 @@ define-command -hidden crystal-trim-indent %{ define-command -hidden crystal-indent-on-char %{ evaluate-commands -no-hooks -draft -itersel %{ - # align 'else/elsif' to 'if' - try %{ execute-keys -draft ^\h*(?:else|elsif)$ i ^\h*(?:if) 1 } - # align 'else/when' to 'case' - try %{ execute-keys -draft ^\h*(?:else|when)$ i ^\h*(?:case) 1 } + # align 'else' to 'if/case' + try %{ execute-keys -draft ^\h*else$ i ^\h*(?:if|case) 1 } + # align 'elsif' to 'if' + try %{ execute-keys -draft ^\h*elsif$ i ^\h*(?:if) 1 } + # align 'when' to 'case' + try %{ execute-keys -draft ^\h*when$ i ^\h*(?:case) 1 } # align 'rescue' to 'begin/def' - try %{ execute-keys -draft ^\h*(?:rescue)$ i ^\h*(?:begin|def) 1 } + try %{ execute-keys -draft ^\h*rescue$ i ^\h*(?:begin|def) 1 } # align 'end' to opening structure - try %{ execute-keys -draft ^\h*(?:end)$ i ^\h*(?:begin|case|class|def|for|if|module|unless|until|while) 1 } + try %{ execute-keys -draft ^\h*end$ i ^\h*(?:begin|case|class|def|for|if|module|unless|until|while) 1 } } }