From 2c382de1e8033dd9f81af6fb67310e3d47f2b36a Mon Sep 17 00:00:00 2001 From: John Isom Date: Sat, 1 Aug 2020 10:08:47 -0600 Subject: [PATCH] Add indenting after starting structure/opening statement --- rc/filetype/crystal.kak | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/rc/filetype/crystal.kak b/rc/filetype/crystal.kak index 3f30e85a..5cece7c3 100644 --- a/rc/filetype/crystal.kak +++ b/rc/filetype/crystal.kak @@ -192,6 +192,8 @@ define-command -hidden crystal-indent-on-new-line %{ try %{ execute-keys -draft K } # Remove previos line's trailing spaces try %{ execute-keys -draft k :ruby-trim-indent } + # Indent after start structure/opening statement + try %{ execute-keys -draft k ^\h*(?:begin|case|class|def|else|elsif|ensure|for|if|module|rescue|unless|until|when|while|.+\bdo$|.+\bdo\h\|.+(?=\|))[^0-9A-Za-z_!?] j } } } @@ -204,7 +206,7 @@ define-command -hidden crystal-indent-on-char %{ 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' } }