Fix auto indentation for if/case and else

This commit is contained in:
John Isom 2020-08-02 11:28:27 -06:00
parent a7e09a31d2
commit fdf38ecc5e

View File

@ -150,10 +150,11 @@ define-command -hidden ruby-trim-indent %{
define-command -hidden ruby-indent-on-char %{
evaluate-commands -no-hooks -draft -itersel %{
# align middle and end structures to start
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-&> }
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-&> }
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-&> }
try %{ execute-keys -draft <a-x> <a-k> ^ \h * (end) $ <ret> <a-a> i <a-semicolon> <a-?> ^ \h * (begin|case|class|def|for|if|module|unless|until|while) <ret> <a-S> 1<a-&> }
try %{ execute-keys -draft <a-x> <a-k> ^ \h * (else) $ <ret> <a-a> i <a-semicolon> <a-?> ^ \h * (if|case) <ret> <a-S> 1<a-&> }
try %{ execute-keys -draft <a-x> <a-k> ^ \h * (elsif) $ <ret> <a-a> i <a-semicolon> <a-?> ^ \h * (if) <ret> <a-S> 1<a-&> }
try %{ execute-keys -draft <a-x> <a-k> ^ \h * (when) $ <ret> <a-a> i <a-semicolon> <a-?> ^ \h * (case) <ret> <a-S> 1<a-&> }
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-&> }
try %{ execute-keys -draft <a-x> <a-k> ^ \h * (end) $ <ret> <a-a> i <a-semicolon> <a-?> ^ \h * (begin|case|class|def|for|if|module|unless|until|while) <ret> <a-S> 1<a-&> }
}
}