Add missing rust indent after function {

This commit is contained in:
Ivan Tham 2020-10-04 14:19:33 +08:00
parent 9401a9fd25
commit b0ae30a443
3 changed files with 9 additions and 0 deletions

View File

@ -155,6 +155,8 @@ define-command -hidden rust-indent-on-new-line %~
# indent after non-empty lines not starting with operator and not ending with , or ; # indent after non-empty lines not starting with operator and not ending with , or ;
# XXX simplify this into a single <a-k> without s # XXX simplify this into a single <a-k> without s
try %< execute-keys -draft k <a-x> s [^\h].+ <ret> <a-K> \A[-+*/&|^})<gt><lt>#] <ret> <a-K> [,<semicolon>](\h*/[/*].*|)$ <ret> j <a-gt> > try %< execute-keys -draft k <a-x> s [^\h].+ <ret> <a-K> \A[-+*/&|^})<gt><lt>#] <ret> <a-K> [,<semicolon>](\h*/[/*].*|)$ <ret> j <a-gt> >
# addition to previous case where it starts with ) and ends with {
try %< execute-keys -draft k <a-x> s [^\h].+ <ret> <a-k> \A\) <ret> <a-k> \{$ <ret> j <a-gt> >
# dedent after lines starting with . and ending with } or ) or , or ; # dedent after lines starting with . and ending with } or ) or , or ;
try %_ execute-keys -draft k <a-x> <a-k> ^\h*\..*[}),<semicolon>]\h*$ <ret> j <a-lt> _ try %_ execute-keys -draft k <a-x> <a-k> ^\h*\..*[}),<semicolon>]\h*$ <ret> j <a-lt> _
# align to opening curly brace or paren when newline is inserted before a single closing # align to opening curly brace or paren when newline is inserted before a single closing

View File

@ -26,3 +26,6 @@
#[derive(Debug)]%( ) #[derive(Debug)]%( )
fn foo(
) -> {%( )

View File

@ -40,3 +40,7 @@
#[derive(Debug)] #[derive(Debug)]
bar bar
fn foo(
) -> {
bar