From 62ac42bb23968b0903cc0b6b5a8353f165edd3e6 Mon Sep 17 00:00:00 2001 From: John Isom Date: Sat, 1 Aug 2020 09:58:21 -0600 Subject: [PATCH] Add 'crystal-trim-indent' command This removes trailing whitespaces from the end of lines --- rc/filetype/crystal.kak | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/rc/filetype/crystal.kak b/rc/filetype/crystal.kak index 663ba26b..3a895045 100644 --- a/rc/filetype/crystal.kak +++ b/rc/filetype/crystal.kak @@ -178,6 +178,14 @@ evaluate-commands %sh[ # Commands # ‾‾‾‾‾‾‾‾ +define-command -hidden crystal-trim-indent %{ + evaluate-commands -no-hooks -draft -itersel %{ + execute-keys + # remove trailing white spaces + try %{ execute-keys -draft s \h+$ d } + } +} + define-command -hidden crystal-indent-on-new-line %{ evaluate-commands -no-hooks -draft -itersel %{ # Copy previous line indent @@ -196,7 +204,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' } }