From 76eadef00b49519179a784e449570b84093b0971 Mon Sep 17 00:00:00 2001 From: John Isom Date: Sat, 1 Aug 2020 10:27:51 -0600 Subject: [PATCH] Add rule to align else/elsif to opening if --- rc/filetype/crystal.kak | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/rc/filetype/crystal.kak b/rc/filetype/crystal.kak index 5cece7c3..8ce70714 100644 --- a/rc/filetype/crystal.kak +++ b/rc/filetype/crystal.kak @@ -201,12 +201,16 @@ define-command -hidden crystal-insert-on-new-line %{ } 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)$ ^\h*(?:if) 1 } + } } define-command -hidden crystal-fetch-keywords %{ set-register dquote %sh{ curl --location https://github.com/crystal-lang/crystal/raw/master/src/compiler/crystal/syntax/lexer.cr | - kak -f '%1scheck_ident_or_keyword\(:(\w+\??), \w+\)y%aa|sort' + kak -f '%1scheck_ident_or_keyword\(:(\w+\??), \w+\)y%aa|sort' } }